mouse0232/API
0
1FROM python:3.9 as py-builder2WORKDIR /code3 4# 拷贝依赖文件并安装依赖5COPY ./requirements.txt .6RUN pip install --no-cache-dir -r requirements.txt7 8FROM python:3.9-slim9ENV TZ=Asia/Shanghai10RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone11 12# 安装必要的系统依赖13RUN apt-get update && apt-get install -y curl procps && rm -rf /var/lib/apt/lists/*14 15WORKDIR /code16 17# 拷贝依赖和应用代码18COPY --from=py-builder /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages19COPY --from=py-builder /usr/local/bin /usr/local/bin20 21COPY ./main.py .22COPY ./update_and_restart.sh .23 24# 设置所有文件和目录的权限为 77725RUN chmod -R 777 /code26 27# 确保启动脚本可执行28RUN chmod +x /code/update_and_restart.sh29 30# 容器启动命令31CMD ["sh", "/code/update_and_restart.sh"]32 