All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 7m50s
- Add dev branch trigger and environment-based config (prod/dev) - Switch to Volcano container registry with retry logic - Use mirror images for Docker base images (daocloud.io) - Add dynamic domain/DB/Redis config per environment Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
33 lines
935 B
Docker
33 lines
935 B
Docker
# 使用国内的 Python 3.8 镜像作为基础镜像
|
|
FROM docker.m.daocloud.io/python:3.8
|
|
# 设置工作目录为 /app
|
|
WORKDIR /app
|
|
|
|
# # 安装系统依赖
|
|
# RUN apt-get update && apt-get install -y \
|
|
# redis-server \
|
|
# && rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制依赖文件
|
|
COPY requirements.txt /app/requirements.txt
|
|
# 使用国内的镜像源安装所需的 Python 库
|
|
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
|
|
|
# 将当前目录下的所有文件复制到容器的 /app 目录下
|
|
COPY . /app
|
|
|
|
# 创建启动脚本
|
|
RUN echo '#!/bin/bash\n\
|
|
service redis-server start\n\
|
|
# 确保日志目录存在\n\
|
|
mkdir -p /app/logs\n\
|
|
# 启动应用并将输出重定向到日志文件\n\
|
|
daphne -b 0.0.0.0 -p 8000 qy_lty.asgi:application 2>&1 | tee /app/logs/daphne.log' > /app/start.sh \
|
|
&& chmod +x /app/start.sh
|
|
|
|
# 暴露端口
|
|
EXPOSE 8000
|
|
|
|
# 容器启动时执行的命令
|
|
CMD ["/app/start.sh"]
|