-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 1007 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (22 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM python:3.11-slim
WORKDIR /app
# Proxy for build-time network access (PyPI, apt)
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY=localhost,127.0.0.1
# Install system dependencies + set timezone
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir --timeout 120 --retries 10 --resume-retries 20 -r requirements.txt
# Copy application code
COPY . .
# Expose web port
EXPOSE 8000
# Default command: run the web server
CMD ["gunicorn", "src.web.app:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:8000", "--workers", "4", "--preload", "--max-requests", "5000", "--max-requests-jitter", "2000", "--graceful-timeout", "60", "--timeout", "600", "--keep-alive", "30"]