From a6144e9692b12197af7f9625000da9b29732a56d Mon Sep 17 00:00:00 2001 From: Toxix Date: Sun, 4 Jul 2021 00:15:29 +0200 Subject: [PATCH] Refector: Do the npm compile as a Build step This removes the requirement of npm on the host system and removes an additional manual step during the building of the docker image. Updated the documentation accordingly and fixed a typo. --- Dockerfile | 11 ++++++++++- compile-frontend.sh | 7 ------- docs/setup.rst | 6 ++---- 3 files changed, 12 insertions(+), 12 deletions(-) delete mode 100755 compile-frontend.sh diff --git a/Dockerfile b/Dockerfile index 6c0caa049..6bd64f508 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,12 @@ +FROM node AS compile-frontend + +COPY . /src + +WORKDIR /src/src-ui +RUN npm install +RUN ./node_modules/.bin/ng build --prod + + FROM ubuntu:20.04 AS jbig2enc WORKDIR /usr/src/jbig2enc @@ -88,7 +97,7 @@ RUN cd docker \ COPY gunicorn.conf.py ../ # copy app -COPY src/ ./ +COPY --from=compile-frontend /src/src/ ./ # add users, setup scripts RUN addgroup --gid 1000 paperless \ diff --git a/compile-frontend.sh b/compile-frontend.sh deleted file mode 100755 index 98b88d033..000000000 --- a/compile-frontend.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -e - -cd src-ui -npm install -./node_modules/.bin/ng build --prod diff --git a/docs/setup.rst b/docs/setup.rst index f8b93f570..ee2cbe77b 100644 --- a/docs/setup.rst +++ b/docs/setup.rst @@ -260,9 +260,7 @@ Build the Docker image yourself webserver: build: . -4. Run the ``compile-frontend.sh`` script. This requires ``node`` and ``npm >= v15``. - -5. Follow steps 3 to 8 of :ref:`setup-docker_hub`. When asked to run +4. Follow steps 3 to 8 of :ref:`setup-docker_hub`. When asked to run ``docker-compose pull`` to pull the image, do .. code:: shell-session @@ -684,7 +682,7 @@ configuring some options in paperless can help improve performance immensely: your documents before feeding them into paperless. Some scanners are able to do this! You might want to even specify ``skip_noarchive`` to skip archive file generation for already ocr'ed documents entirely. -* If you want to perform OCR on the the device, consider using ``PAPERLESS_OCR_CLEAN=none``. +* If you want to perform OCR on the device, consider using ``PAPERLESS_OCR_CLEAN=none``. This will speed up OCR times and use less memory at the expense of slightly worse OCR results. * Set ``PAPERLESS_OPTIMIZE_THUMBNAILS`` to 'false' if you want faster consumption