Перенести решение lab3 как базу lab4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-30 13:37:23 +03:00
co-authored by Claude Opus 5.5
parent ec540a1a72
commit e9ee60b0ba
31 changed files with 2856 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
# Messenger API (lab3). One image for the "api" and "migrate" services.
FROM python:3.12.7-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app ./app
COPY scripts/migrate.py ./scripts/migrate.py
COPY migrations ./migrations
RUN useradd --create-home --uid 10001 appuser
USER appuser
EXPOSE 8080
# Exec form: python is PID 1 and receives SIGTERM from "docker stop" itself.
# (lab2 used "sh -c uvicorn ...": sh stayed PID 1, uvicorn never got SIGTERM
# and was killed together with the container instead of draining.)
CMD ["python", "-m", "app.server"]