Dockerfile build performance improvements
authorAdam Dullage <redacted>
Mon, 22 Aug 2022 12:35:32 +0000 (13:35 +0100)
committerAdam Dullage <redacted>
Mon, 22 Aug 2022 12:35:32 +0000 (13:35 +0100)
Dockerfile

index ca018d1f5858216a6fec0f611c0f06df009d6454..8cc342b9ed81ef4c0abf612ee0885c28436a22e8 100644 (file)
@@ -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" ]
git clone https://git.99rst.org/PROJECT