From 803d41a4176f7d31c023f176a8c8c04affad4a89 Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 4 Oct 2024 16:16:43 +0200 Subject: [PATCH] feat(Dockerfile): optimize Python package installation Refactor Dockerfile to install project dependencies directly from the app directory. This change ensures the installed version matches the source code, potentially reducing mismatches between dependencies and code. Also separates the virtual environment creation step for better clarity. --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2db183..5e2940d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,12 @@ ENV APP_ENV=/opt/venv ENV PATH="${APP_ENV}/bin:$PATH" RUN apk add --no-cache py3-pip uwsgi-python3 && \ - python3 -m venv $APP_ENV && \ - $APP_ENV/bin/pip install --no-cache-dir pip structables && \ + python3 -m venv $APP_ENV + +COPY . /app + +RUN $APP_ENV/bin/pip install --no-cache-dir pip && \ + $APP_ENV/bin/pip install /app && \ adduser -S -D -H structables COPY entrypoint.sh /entrypoint.sh