11 lines
606 B
Docker
11 lines
606 B
Docker
FROM python:3.11-slim
|
|
ENV TZ=Asia/Shanghai PYTHONUNBUFFERED=1 XBNIU_PREVIEW=1 XBNIU_DB_PATH=/data/preview.db PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
WORKDIR /app
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt gunicorn==23.0.0
|
|
COPY . .
|
|
RUN mkdir -p /data
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=20s --timeout=5s --start-period=20s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=3)"
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "1", "--threads", "4", "--timeout", "60", "preview_server:app"]
|