Исходники, миграции, Dockerfile и стенд lab4 нужны как основа асинхронной обработки вложений. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
778 B
Docker
30 lines
778 B
Docker
FROM python:3.12.8-slim-bookworm AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
RUN groupadd --system app && useradd --system --gid app --home /app --shell /usr/sbin/nologin app \
|
|
&& apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY app ./app
|
|
COPY migrations ./migrations
|
|
COPY contracts/openapi.json ./contracts/openapi.json
|
|
|
|
USER app
|
|
|
|
ENV APP_HOST=0.0.0.0 \
|
|
APP_PORT=8080 \
|
|
APP_ENV=lab \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=12 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
|
|
|
CMD ["python", "-m", "app.main"]
|