yikes / Dockerfile
meyosaj406's picture
Create Dockerfile
b0a8265 verified
raw
history blame contribute delete
490 Bytes
# 1. 使用官方的Python 3.9 slim镜像
FROM python:3.9-slim
# 2. 在容器内创建一个叫 /app 的工作目录
WORKDIR /app
# 3. 复制所有文件到 /app 目录
# (app.py, requirements.txt, index.html, style.css, script.js)
COPY . .
# 4. 安装 requirements.txt 中定义的依赖 (即 Flask)
RUN pip install --no-cache-dir -r requirements.txt
# 5. 告诉Docker,我们的应用会监听 7860 端口
EXPOSE 7860
# 6. 容器启动时要运行的命令
CMD ["python", "app.py"]