From dec3b5317aed7a019a26d6ab6cef1bceb381b3e1 Mon Sep 17 00:00:00 2001 From: ldeluigi Date: Tue, 29 Nov 2022 14:27:14 +0100 Subject: [PATCH] Optimize dockerfile and dockerignore --- backend/.dockerignore | 3 +++ backend/Dockerfile | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/.dockerignore b/backend/.dockerignore index d26a0822..213a38da 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -4,3 +4,6 @@ docker-*.yml Dockerfile *.md nginx/ +__pycache__ +./temp +*_data.json diff --git a/backend/Dockerfile b/backend/Dockerfile index a4a880ab..2294128a 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -47,7 +47,7 @@ RUN addgroup -S app && adduser -S app -G app # create the appropriate directories ENV HOME=/home/app ENV APP_HOME=/home/app/web -RUN mkdir -p $APP_HOME/staticfiles +RUN mkdir -p $APP_HOME/staticfiles && chown -R app:app $APP_HOME WORKDIR $APP_HOME # install dependencies @@ -57,10 +57,7 @@ COPY --from=builder /usr/src/app/requirements.txt . RUN pip install --no-cache /wheels/* # copy project -COPY . $APP_HOME - -# chown all the files to the app user -RUN chown -R app:app $APP_HOME +COPY --chown=app:app . $APP_HOME # change to the app user USER app