|
|
|
@ -1,10 +1,8 @@ |
|
|
|
FROM docker.io/python:3.10.16-slim |
|
|
|
|
|
|
|
# 替换 Debian12 的 .sources 文件为清华镜像 |
|
|
|
RUN sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources \ |
|
|
|
&& sed -i 's|security.debian.org|mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/debian.sources |
|
|
|
|
|
|
|
# 安装依赖(带重试) |
|
|
|
RUN apt-get update \ |
|
|
|
&& apt-get install -y --no-install-recommends \ |
|
|
|
gcc g++ unixodbc unixodbc-dev default-libmysqlclient-dev \ |
|
|
|
@ -15,14 +13,13 @@ RUN apt-get update \ |
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple |
|
|
|
|
|
|
|
COPY config.py /app/config.py |
|
|
|
COPY app.py /app/app.py |
|
|
|
COPY *.py /app/ |
|
|
|
COPY requirements.txt /app/ |
|
|
|
# 🔥 只复制除 config.py 外的全部代码 |
|
|
|
COPY . . |
|
|
|
|
|
|
|
# 🔥 再显式复制 config.py(此时一定是文件) |
|
|
|
COPY config.py /app/config.py |
|
|
|
|
|
|
|
RUN mkdir -p /opt/alert/model-lab \ |
|
|
|
&& cp /app/config.py /opt/alert/model-lab/config.py |
|
|
|
|