Files
Scoring-System/backend/Dockerfile
爽哒哒 e68941b67c
All checks were successful
Deploy to Server / deploy (push) Successful in 1m58s
perf: remove source code volume mount, collectstatic at build time
2026-03-21 11:54:19 +08:00

29 lines
629 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 使用 Python 3.13 slim 镜像作为基础镜像
FROM python:3.13-slim
# 设置环境变量
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 设置工作目录
WORKDIR /app
# 安装 python 依赖
COPY requirements.txt /app/
RUN pip install --upgrade pip && pip install -r requirements.txt
# 复制项目
COPY . /app/
COPY .env /app/
# 收集静态文件build 时执行,避免每次启动都跑)
RUN python manage.py collectstatic --noinput || true
# 暴露端口
EXPOSE 8876
# Volume for media files
VOLUME ["/app/media"]
# 启动命令
CMD ["gunicorn", "--bind", "0.0.0.0:8876", "config.wsgi:application"]