Files
structure/dockerfiles/python/Dockerfile.example
WP Studio 537b5ad4be + python services and python nginx conf example
+ also example of Dockerfile for python project and needed to place onto your project directory
2025-04-08 17:13:21 +03:00

27 lines
541 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}
ARG PUID=1000
ARG PGID=1000
RUN groupadd -g ${PGID} pydock && \
useradd -u ${PUID} -g pydock -m pydock && \
usermod -p "*" pydock -s /bin/bash
RUN mkdir /venv && chown ${PUID}:${PGID} /venv
USER pydock
# Создаём виртуальное окружение ВНЕ /app
RUN python -m venv /venv
ENV PATH="/venv/bin:$PATH"
WORKDIR /app
COPY requirements.txt .
VOLUME /pip_cache
RUN . /venv/bin/activate && pip install --cache-dir=/pip_cache -r requirements.txt
EXPOSE 8000