基础镜像,避免每次重打耗时 docker build -f Dockerfile_base -t index-base:latest --platform linux/arm64 .
This commit is contained in:
31
Dockerfile_base
Normal file
31
Dockerfile_base
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
# 暴露端口
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# 运行应用
|
||||||
|
# CMD ["python", "update_data.py"]
|
||||||
Reference in New Issue
Block a user