feat(Dockerfile): optimize Python package installation
Some checks failed
Docker CI/CD / Docker Build and Push to Docker Hub (push) Successful in 2m33s
Python Package CI/CD / Publish to PyPI (push) Failing after 1m11s

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.
This commit is contained in:
Kumi 2024-10-04 16:16:43 +02:00
parent 1d534cf3d3
commit 803d41a417
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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