forked from mtusi2026/mtusi2026lab4
Carry over lab3 HA stack and add private S3 storage, Attachment API, orphan compensation/reaper, own tests, and evidence for smoke/persistence/failover.
28 lines
863 B
Docker
28 lines
863 B
Docker
# Закреплённый runtime-образ (Python интерпретируемый — один stage).
|
|
FROM python:3.12.7-slim-bookworm
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
APP_HOST=0.0.0.0 \
|
|
APP_PORT=8080
|
|
|
|
WORKDIR /app
|
|
|
|
RUN groupadd --system app && useradd --system --gid app --home /app --shell /usr/sbin/nologin app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app ./app
|
|
COPY migrations ./migrations
|
|
|
|
USER app
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=5 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
|
|
|
# PID 1 = uvicorn; SIGTERM обрабатывается lifespan'ом приложения.
|
|
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]
|