perf: remove source code volume mount, collectstatic at build time
All checks were successful
Deploy to Server / deploy (push) Successful in 1m58s

This commit is contained in:
爽哒哒
2026-03-21 11:54:19 +08:00
parent 78e69152b4
commit e68941b67c
2 changed files with 5 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ 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

View File

@@ -2,10 +2,10 @@ services:
backend:
build: ./backend
container_name: cywl-scoring-backend
command: sh -c "python manage.py collectstatic --noinput && python manage.py migrate && gunicorn --bind 0.0.0.0:8876 --workers 4 --timeout 120 --access-logfile - --error-logfile - config.wsgi:application"
command: sh -c "python manage.py migrate && gunicorn --bind 0.0.0.0:8876 --workers 4 --timeout 120 --access-logfile - --error-logfile - config.wsgi:application"
volumes:
- ./backend:/app
- ./backend/media:/app/media
- ./backend/.env:/app/.env
ports:
- "8876:8876"
environment: