集群镜像
This commit is contained in:
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@@ -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"]
|
||||
Reference in New Issue
Block a user