Files
mtusi2026lab4/Dockerfile
T

17 lines
779 B
Docker

# Google public mirror of the official Docker Python image; immutable digest.
FROM mirror.gcr.io/library/python@sha256:34386ef0cb081344d7ec1c103ba398e6e9f64e9ab3a1509accc92a4e24a07258
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PYTHONUTF8=1 \
APP_HOST=0.0.0.0 APP_PORT=8080
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt && \
groupadd --gid 10001 messenger && useradd --uid 10001 --gid 10001 --no-create-home messenger
COPY src ./src
COPY migrations ./migrations
USER 10001:10001
EXPOSE 8080
STOPSIGNAL SIGTERM
HEALTHCHECK --interval=5s --timeout=6s --start-period=60s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=5)"
CMD ["python", "-m", "src"]