26 lines
482 B
Docker
26 lines
482 B
Docker
# FastAPI 后端 Docker 镜像
|
|
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装系统依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 安装 Python 依赖
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 复制应用代码
|
|
COPY . .
|
|
|
|
# 创建上传目录
|
|
RUN mkdir -p uploads
|
|
|
|
# 暴露端口
|
|
EXPOSE 3000
|
|
|
|
# 启动命令
|
|
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3000"]
|