chore: 重命名容器为 cywl-scoring-* 避免与服务器其他项目冲突
All checks were successful
Deploy to Server / deploy (push) Successful in 7m25s

This commit is contained in:
爽哒哒
2026-03-18 23:25:04 +08:00
parent c71ea29f54
commit 2b419cebb5
3 changed files with 14 additions and 14 deletions

View File

@@ -39,8 +39,8 @@ jobs:
echo $SUDO_PASSWORD | sudo -S docker compose down --remove-orphans 2>/dev/null || true
# 等待容器完全停止
sleep 5
# 强制删除可能残留容器
echo $SUDO_PASSWORD | sudo -S docker ps -aq --filter "name=scoring" | xargs -r docker rm -f 2>/dev/null || true
# 清理本项目残留容器(避免影响其他项目)
echo $SUDO_PASSWORD | sudo -S docker ps -aq --filter "name=cywl-scoring" | xargs -r docker rm -f 2>/dev/null || true
# 4. 拉取 Git 最新代码
echo -e "\n===== 拉取 Git 代码 ====="

View File

@@ -2,11 +2,11 @@ version: '3.8'
services:
# 后端服务
backend:
scoring-backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: scoring_backend
container_name: cywl-scoring-backend
restart: always
volumes:
- ./backend/media:/app/media
@@ -41,18 +41,18 @@ services:
start_period: 40s
# 前端服务 (Nginx)
frontend:
scoring-frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- VITE_API_URL=/api
container_name: scoring_frontend
container_name: cywl-scoring-frontend
restart: always
ports:
- "80:80"
depends_on:
backend:
scoring-backend:
condition: service_healthy
networks:
- scoring_network
@@ -63,9 +63,9 @@ services:
retries: 3
# Nginx 反向代理 (可选,用于负载均衡和 SSL)
nginx:
scoring-nginx:
image: nginx:alpine
container_name: scoring_nginx
container_name: cywl-scoring-nginx
restart: always
ports:
- "443:443"
@@ -73,8 +73,8 @@ services:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
depends_on:
- frontend
- backend
- scoring-frontend
- scoring-backend
networks:
- scoring_network
profiles:

View File

@@ -25,7 +25,7 @@ server {
# API 代理 - 将 /api 请求转发到后端
location /api/ {
proxy_pass http://backend:8000/api/;
proxy_pass http://scoring-backend:8876/api/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -38,7 +38,7 @@ server {
# 媒体文件代理
location /media/ {
proxy_pass http://backend:8000/media/;
proxy_pass http://scoring-backend:8876/media/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -46,7 +46,7 @@ server {
# 静态文件代理
location /static/ {
proxy_pass http://backend:8000/static/;
proxy_pass http://scoring-backend:8876/static/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;