diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5734634..3031e11 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,15 +1,37 @@ -FROM node:alpine - -RUN apk add libreoffice ffmpeg imagemagick tesseract-ocr - - -RUN apk add msttcorefonts-installer && \ - update-ms-fonts && \ - fc-cache -f - -RUN apk add --update openjdk11 -RUN java --version - -# differs from production dockerfile -RUN apk add git - +FROM node:alpine + +RUN apk add libreoffice ffmpeg imagemagick tesseract-ocr + + +RUN apk add msttcorefonts-installer && \ + update-ms-fonts && \ + fc-cache -f + +RUN apk add --update openjdk11 +RUN java --version + +RUN apk search -qe 'font-bitstream-*' | xargs apk add \ + && apk add \ + font-arabic-misc \ + font-daewoo-misc \ + ttf-inconsolata \ + font-ipa \ + font-isas-misc \ + font-jis-misc \ + font-misc-misc \ + font-noto \ + font-noto-extra \ + font-noto-thai \ + font-noto-tibetan \ + font-noto-cjk \ + font-sony-misc \ + terminus-font \ + ttf-inconsolata \ + ttf-dejavu \ + ttf-font-awesome \ + && fc-cache -fv + + +# differs from production dockerfile +RUN apk add git + diff --git a/.dockerignore b/.dockerignore index f31cd6c..f8f1cfe 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,5 @@ -.git -node_modules -test -*.log \ No newline at end of file +.devcontainer +.git +node_modules +test +*.log diff --git a/Dockerfile b/Dockerfile index e510092..90f6683 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,48 @@ -FROM node:alpine - -RUN apk add libreoffice ffmpeg imagemagick tesseract-ocr - - -RUN apk add msttcorefonts-installer && \ - update-ms-fonts && \ - fc-cache -f - -RUN apk add --update openjdk11 -RUN java --version - -WORKDIR /usr/src/app - -COPY package.json . -COPY package-lock.json . - -RUN npm install && npm audit fix --force - -COPY . . - -EXPOSE 3000 - -CMD [ "node", "index.js" ] +FROM node:alpine + +RUN apk add libreoffice ffmpeg imagemagick tesseract-ocr + + +RUN apk add msttcorefonts-installer && \ + update-ms-fonts && \ + fc-cache -f + +RUN apk add --update openjdk11 +RUN java --version + +RUN apk search -qe 'font-bitstream-*' | xargs apk add \ + && apk add \ + font-arabic-misc \ + font-daewoo-misc \ + ttf-inconsolata \ + font-ipa \ + font-isas-misc \ + font-jis-misc \ + font-misc-misc \ + font-noto \ + font-noto-extra \ + font-noto-thai \ + font-noto-tibetan \ + font-noto-cjk \ + font-sony-misc \ + terminus-font \ + ttf-inconsolata \ + ttf-dejavu \ + ttf-font-awesome \ + && fc-cache -fv + + +WORKDIR /usr/src/app + +COPY package.json . +COPY package-lock.json . + +ENV NODE_ENV production + +RUN npm install --omit=dev && npm audit fix --omit=dev --force + +COPY . . + +EXPOSE 3000 + +CMD [ "npm", "start" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8c331b7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.7' + +services: + versed: + build: . + ports: + - 3000:3000 + restart: "on-failure" + environment: + - DEBUG=versed* diff --git a/test/test_utils.js b/test/test_utils.js index a890337..edbef65 100644 --- a/test/test_utils.js +++ b/test/test_utils.js @@ -5,20 +5,20 @@ import * as util from '../util.js'; describe('Util', function () { describe('#mimetype()', function () { - it('should return type image of format png for "testing.png"', function () { + it('should return type "image" of format "png" for "testing.png"', function () { const res = util.mimetype('testing.png'); assert.equal(res.type, 'image'); assert.equal(res.format, 'png'); }); - it('should return type image of format png for "testing.docx"', function () { + it('should return type "application" of format "vnd.openxmlformats-officedocument.wordprocessingml.document" for "testing.docx"', function () { const res = util.mimetype('testing.docx'); assert.equal(res.full, 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'); assert.equal(res.type, 'application'); assert.equal(res.format, 'vnd.openxmlformats-officedocument.wordprocessingml.document'); }); - it('should return type image of format png for "testing.mkv"', function () { + it('should return type "video" of format "x-matroska" for "testing.mkv"', function () { const res = util.mimetype('testing.mkv'); assert.equal(res.full, 'video/x-matroska'); assert.equal(res.type, 'video');