From 199a5eb92a37eb2753b6ab20f7d6bf07a47d4768 Mon Sep 17 00:00:00 2001 From: yshtcn Date: Thu, 12 Oct 2023 22:29:58 +0800 Subject: [PATCH] =?UTF-8?q?docker=E6=89=93=E5=8C=85=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1a85c4e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# 使用官方的 Python 3.11 镜像作为基础镜像 +FROM python:3.11-slim + +# 设置工作目录 +WORKDIR /usr/src/app + +# 将当前目录下的所有文件复制到镜像中的工作目录 +COPY . . + +# 创建/data目录用于存储生成的文件 +RUN mkdir /data + +# 定义环境变量 PIP_INDEX_URL 并设置其默认值为清华大学的更新源 +ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple + +# 安装 Python 依赖 +RUN pip install --no-cache-dir -i $PIP_INDEX_URL requests + +# 设置容器启动后执行的命令 +CMD [ "python", "./Diary Assistant.py" ]