From 938ac14bfb6b39ab7cbc02f01e1e2a9ffc0cef1d Mon Sep 17 00:00:00 2001 From: aszerW Date: Sun, 12 Oct 2025 13:36:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E7=BE=A4=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6efc972 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM python:3.12-slim + +# 设置工作目录 +WORKDIR /app + +RUN apt-get update && \ + apt-get install -y --no-install-recommends tzdata && \ + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + dpkg-reconfigure -f noninteractive tzdata && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install uv \ + && rm -rf /root/.cache/pip + +ENV UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple + +# 复制依赖文件 +COPY requirements.txt . + +# 配置清华源并安装 Python 依赖 +# RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \ +# pip install --only-binary=all --no-cache-dir -r requirements.txt + +RUN uv pip install --system -r requirements.txt + +# 仅复制除 data 目录外的应用代码 +COPY . . +RUN rm -rf ./data + +# 暴露端口 +EXPOSE 80 + +# 运行应用 +CMD ["python", "update_data.py"] \ No newline at end of file