28 lines
711 B
Docker
28 lines
711 B
Docker
FROM python:3.11-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
APP_ENV=production
|
|
|
|
WORKDIR /app
|
|
|
|
COPY requirements.txt .
|
|
|
|
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
--no-cache-dir \
|
|
-r requirements.txt
|
|
|
|
COPY app ./app
|
|
COPY scripts ./scripts
|
|
COPY pyproject.toml README.md ./
|
|
|
|
RUN mkdir -p /app/logs /app/storage/reports
|
|
|
|
EXPOSE 9000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:9000/health/live', timeout=3)"
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "9000", "--proxy-headers", "--forwarded-allow-ips=*"]
|