17 lines
378 B
Plaintext
17 lines
378 B
Plaintext
# 使用官方Python运行时作为父镜像
|
|
FROM python:3.9-slim
|
|
|
|
# 设置容器内的工作目录
|
|
WORKDIR /app
|
|
|
|
# 将当前目录内容复制到容器的 /app 下
|
|
COPY . /app
|
|
|
|
# 安装项目所需的依赖
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 声明容器运行时监听的端口号
|
|
EXPOSE 8080
|
|
|
|
# 定义容器启动后执行的命令
|
|
CMD ["python", "app.py"] |