13 lines
627 B
Docker
13 lines
627 B
Docker
FROM python:3.11.10-slim-bookworm
|
|
WORKDIR /app
|
|
# Приложение работает без прав root.
|
|
RUN groupadd -r appuser && useradd -r -g appuser appuser
|
|
COPY requirements.lock.txt .
|
|
RUN pip install --no-cache-dir -r requirements.lock.txt
|
|
COPY src/ src/
|
|
COPY migrations/ migrations/
|
|
USER appuser
|
|
HEALTHCHECK --interval=5s --timeout=5s --start-period=15s --retries=5 CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health/ready')"
|
|
EXPOSE 8080
|
|
CMD ["sh", "-c", "python -m src.migrate && exec python -m uvicorn src.app:app --host 0.0.0.0 --port 8080 --timeout-graceful-shutdown 8"]
|