From 92692862812e3742f0b4f3d8715bc217e3550855 Mon Sep 17 00:00:00 2001 From: bolyachevets Date: Mon, 30 Dec 2024 17:17:28 -0800 Subject: [PATCH 1/2] add most volatile layer last --- api/Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/Dockerfile b/api/Dockerfile index 8b8aeced1..58c91334b 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -77,9 +77,6 @@ RUN groupadd -g "${GID}" -r web \ # Copy only requirements, to cache them in docker layer COPY --chown=web:web ./poetry.lock ./pyproject.toml /code/ -COPY --chown=web:web ./namex /code/namex -COPY --chown=web:web ./README.md /code - # Project initialization: RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \ echo "$APP_ENV" \ @@ -93,9 +90,8 @@ RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \ # Running as non-root user: USER web -# The following stage is only for production: -# FROM development_build AS production_build -COPY --chown=web:web . /code +COPY --chown=web:web ./namex /code/namex +COPY --chown=web:web ./README.md /code # Run the server ENV PYTHONPATH=/code From 0338ae38601b4ef6617666a3fa196dd2c4f5de7f Mon Sep 17 00:00:00 2001 From: bolyachevets Date: Mon, 30 Dec 2024 17:23:05 -0800 Subject: [PATCH 2/2] speed up mailer build --- services/emailer/Dockerfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/services/emailer/Dockerfile b/services/emailer/Dockerfile index 5bb591cfb..9ad2b90b8 100644 --- a/services/emailer/Dockerfile +++ b/services/emailer/Dockerfile @@ -64,9 +64,6 @@ RUN groupadd -g "${GID}" -r web \ # Copy only requirements, to cache them in docker layer COPY --chown=web:web ./poetry.lock ./pyproject.toml /code/ -COPY --chown=web:web ./src /code/src -COPY --chown=web:web ./README.md /code - # Project initialization: RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \ echo "$APP_ENV" \ @@ -80,10 +77,7 @@ RUN --mount=type=cache,target="$POETRY_CACHE_DIR" \ # Running as non-root user: USER web -# The following stage is only for production: -# FROM development_build AS production_build -COPY --chown=web:web . /code - -# ENV PYTHONPATH=/opt/app-root/src +COPY --chown=web:web ./src /code/src +COPY --chown=web:web ./README.md /code CMD gunicorn --preload --bind 0.0.0.0:${PORT} --config /code/gunicorn_config.py wsgi:app