forked from quant-speed-AI/Scoring-System
chore: 重命名容器为 cywl-scoring-* 避免与服务器其他项目冲突
This commit is contained in:
@@ -39,8 +39,8 @@ jobs:
|
|||||||
echo $SUDO_PASSWORD | sudo -S docker compose down --remove-orphans 2>/dev/null || true
|
echo $SUDO_PASSWORD | sudo -S docker compose down --remove-orphans 2>/dev/null || true
|
||||||
# 等待容器完全停止
|
# 等待容器完全停止
|
||||||
sleep 5
|
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 最新代码
|
# 4. 拉取 Git 最新代码
|
||||||
echo -e "\n===== 拉取 Git 代码 ====="
|
echo -e "\n===== 拉取 Git 代码 ====="
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
# 后端服务
|
# 后端服务
|
||||||
backend:
|
scoring-backend:
|
||||||
build:
|
build:
|
||||||
context: ./backend
|
context: ./backend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: scoring_backend
|
container_name: cywl-scoring-backend
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend/media:/app/media
|
- ./backend/media:/app/media
|
||||||
@@ -41,18 +41,18 @@ services:
|
|||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
# 前端服务 (Nginx)
|
# 前端服务 (Nginx)
|
||||||
frontend:
|
scoring-frontend:
|
||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
- VITE_API_URL=/api
|
- VITE_API_URL=/api
|
||||||
container_name: scoring_frontend
|
container_name: cywl-scoring-frontend
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
backend:
|
scoring-backend:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- scoring_network
|
- scoring_network
|
||||||
@@ -63,9 +63,9 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
|
|
||||||
# Nginx 反向代理 (可选,用于负载均衡和 SSL)
|
# Nginx 反向代理 (可选,用于负载均衡和 SSL)
|
||||||
nginx:
|
scoring-nginx:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
container_name: scoring_nginx
|
container_name: cywl-scoring-nginx
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "443:443"
|
- "443:443"
|
||||||
@@ -73,8 +73,8 @@ services:
|
|||||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
- ./nginx/ssl:/etc/nginx/ssl:ro
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
||||||
depends_on:
|
depends_on:
|
||||||
- frontend
|
- scoring-frontend
|
||||||
- backend
|
- scoring-backend
|
||||||
networks:
|
networks:
|
||||||
- scoring_network
|
- scoring_network
|
||||||
profiles:
|
profiles:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ server {
|
|||||||
|
|
||||||
# API 代理 - 将 /api 请求转发到后端
|
# API 代理 - 将 /api 请求转发到后端
|
||||||
location /api/ {
|
location /api/ {
|
||||||
proxy_pass http://backend:8000/api/;
|
proxy_pass http://scoring-backend:8876/api/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -38,7 +38,7 @@ server {
|
|||||||
|
|
||||||
# 媒体文件代理
|
# 媒体文件代理
|
||||||
location /media/ {
|
location /media/ {
|
||||||
proxy_pass http://backend:8000/media/;
|
proxy_pass http://scoring-backend:8876/media/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -46,7 +46,7 @@ server {
|
|||||||
|
|
||||||
# 静态文件代理
|
# 静态文件代理
|
||||||
location /static/ {
|
location /static/ {
|
||||||
proxy_pass http://backend:8000/static/;
|
proxy_pass http://scoring-backend:8876/static/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|||||||
Reference in New Issue
Block a user