You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
462 B
Docker
24 lines
462 B
Docker
|
|
# 使用 Python 基础镜像
|
|
FROM python:3.12
|
|
|
|
# 设置工作目录
|
|
WORKDIR /app
|
|
|
|
# 更换 pip 源为阿里云源
|
|
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
|
|
|
# 复制项目文件
|
|
COPY requirements.txt .
|
|
|
|
# 安装 Python 依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 复制项目代码
|
|
COPY . .
|
|
|
|
# 暴露端口
|
|
EXPOSE 8000
|
|
|
|
# 启动 FastAPI 应用
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5000"] |