From: Adam Dullage Date: Mon, 22 Aug 2022 12:35:32 +0000 (+0100) Subject: Dockerfile build performance improvements X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=e31c5aa124b521328df25925c1d0fb8379bd328a;p=flatnotes.git Dockerfile build performance improvements --- diff --git a/Dockerfile b/Dockerfile index ca018d1..8cc342b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,6 @@ RUN addgroup \ RUN adduser \ --disabled-password \ --gecos "" \ - --no-create-home \ --ingroup ${USER} \ --uid ${UID} \ ${USER} \ @@ -29,15 +28,14 @@ RUN apt update && apt install -y \ && pip install pipenv RUN mkdir -p ${DATA_DIR} +RUN chown -R ${UID}:${GID} ${APP_DIR} WORKDIR ${APP_DIR} +USER ${UID} -COPY LICENSE Pipfile Pipfile.lock package.json package-lock.json ./ -RUN pipenv install --system --deploy --ignore-pipfile && npm ci +COPY --chown=${UID}:${GID} LICENSE Pipfile Pipfile.lock package.json package-lock.json ./ +RUN pipenv install --deploy --ignore-pipfile && npm ci -COPY flatnotes ./flatnotes +COPY --chown=${UID}:${GID} flatnotes ./flatnotes RUN npm run build -RUN chown -R ${UID}:${GID} ${APP_DIR} -USER ${UID} - -ENTRYPOINT [ "python", "-m", "uvicorn", "main:app", "--app-dir", "flatnotes", "--host", "0.0.0.0", "--port", "80" ] +ENTRYPOINT [ "pipenv", "run", "python", "-m", "uvicorn", "main:app", "--app-dir", "flatnotes", "--host", "0.0.0.0", "--port", "80" ]