Wulf / nodehun

The Hunspell binding for NodeJS that exposes as much of Hunspell as possible and also adds new features. Hunspell is a first class spellcheck library used by Google, Apple, and Mozilla.
MIT License
287 stars 42 forks source link

Library don't works inside docker container #98

Closed Crazy-kun closed 2 years ago

Crazy-kun commented 2 years ago

My Dockerfile:

FROM node:12.10-alpine

ENV TZ Europe/Moscow

RUN apk add --no-cache g++ gcc make python hunspell

RUN mkdir -p /var/www
COPY . /var/www
WORKDIR /var/www

RUN npm -v \
    && npm i node-gyp \
    && npm ci \
    && npm run build \
    && npm cache clean --force

EXPOSE 80
CMD ["node", "--harmony", "--max-http-header-size=262144", "dist/server/index.js"]

My index.ts:

import { Nodehun } from "nodehun";
import fs from "fs";

const affix = fs.readFileSync("./data/ru_RU.aff");
const dict = fs.readFileSync("./data/ru_RU.dic");
const nodehun = new Nodehun(affix, dict);

const is_right = nodehun.spellSync("text");

console.log("unreachable code");

Result: [Node] [nodemon] app crashed - waiting for file changes before starting...

If i run it outside the container - all works fine.