Initial commit: rdgen with GitHub/Gitea dual build backend
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
FROM python:3.13-alpine
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=1
|
||||
|
||||
WORKDIR /opt/rdgen
|
||||
|
||||
# 先单独安装依赖,尽量复用 Docker 层缓存
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 拷贝项目源码
|
||||
COPY . .
|
||||
|
||||
# su-exec 用于在入口脚本中降权运行;创建非 root 用户与数据目录;
|
||||
# 预收集静态文件(WhiteNoise 直接由应用进程对外提供)
|
||||
RUN apk add --no-cache su-exec wget \
|
||||
&& adduser -D -u 1000 appuser \
|
||||
&& mkdir -p exe png temp_zips data static \
|
||||
&& sed -i 's/\r$//' docker-entrypoint.sh \
|
||||
&& chmod +x docker-entrypoint.sh \
|
||||
&& python manage.py collectstatic --noinput \
|
||||
&& chown -R appuser:appuser /opt/rdgen
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# 健康检查:业务根路径需要登录会 302,故检查专用的 /healthz
|
||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
||||
CMD wget -q -O /dev/null http://127.0.0.1:8000/healthz/ || exit 1
|
||||
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
CMD ["gunicorn", "-c", "gunicorn.conf.py", "rdgen.wsgi:application"]
|
||||
Reference in New Issue
Block a user