sizhi-openai / Dockerfile
ZHZ1024's picture
Update Dockerfile
086f2ca verified
raw
history blame contribute delete
739 Bytes
# 使用官方Python轻量镜像
FROM python:3.9-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖(用于健康检查)
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# 复制依赖文件
COPY requirements.txt .
# 安装Python依赖(使用阿里云镜像加速)
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
# 复制应用代码
COPY app.py .
# 暴露端口
EXPOSE 8000
# 健康检查
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/healthz || exit 1
# 启动命令(带热重载配置)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]