19 lines
490 B
Docker
19 lines
490 B
Docker
FROM python:3.10-slim
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . /app
|
|
|
|
# 安装系统依赖(必要时)
|
|
RUN apt-get update && apt-get install -y build-essential && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# 安装 Python 依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 声明服务监听端口(供 Kubernetes 或 docker run -P 使用)
|
|
EXPOSE 8000
|
|
|
|
# 启动服务(可指定绑定 IP 和端口)
|
|
CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "-c", "gunicorn_config.py"]
|