32 lines
879 B
Docker
32 lines
879 B
Docker
FROM python:3.11-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install -r requirements.txt
|
|
|
|
# Копируем код приложения, миграции и скрипты
|
|
COPY src/app ./app
|
|
COPY src/migrations ./migrations
|
|
COPY scripts ./scripts
|
|
|
|
# не root
|
|
RUN useradd --create-home --shell /bin/bash appuser \
|
|
&& chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=5s --timeout=2s --start-period=10s --retries=6 \
|
|
CMD curl -fsS http://127.0.0.1:8080/health/live || exit 1
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--proxy-headers", "--forwarded-allow-ips", "*"] |