daily/Dockerfile

24 lines
523 B
Docker
Raw Permalink Normal View History

2023-07-13 12:20:56 +08:00
# 使用 Python 3.8 作为基础镜像
FROM python:3.9
# 设置工作目录
WORKDIR /app
# 复制项目的 requirements.txt 文件到容器内
COPY requirements.txt .
# 安装项目依赖
2023-07-13 13:31:39 +08:00
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
2023-07-13 12:20:56 +08:00
# 复制项目代码到容器内的 /app 目录
# 设置环境变量,指定端口号和主模块
2023-07-13 13:52:08 +08:00
ENV PORT=8006
2023-07-13 12:20:56 +08:00
ENV MODULE_NAME=my_fastapi_app.main:app
# 暴露指定的端口
EXPOSE $PORT
2023-07-13 13:31:39 +08:00
## 启动 FastAPI 应用
#CMD python main.py