From acecb19a73801f4d97aacc017273b8d7b30335f0 Mon Sep 17 00:00:00 2001 From: ycg <3208975282@qq.com> Date: Wed, 19 Nov 2025 13:55:22 +0800 Subject: [PATCH] 111 --- DockerFile | 17 +++++++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 DockerFile create mode 100644 docker-compose.yml diff --git a/DockerFile b/DockerFile new file mode 100644 index 0000000..84cb85d --- /dev/null +++ b/DockerFile @@ -0,0 +1,17 @@ +# 使用官方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"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..da7cd7f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3' +services: + web: + build: . + ports: + - "8080:8080" + # 可以在此定义数据库等服务 \ No newline at end of file