fix: docker-compose 注入 JWT_SECRET + 修复健康检查

This commit is contained in:
Sisyphus
2026-04-25 20:36:48 +08:00
parent a5452e3d68
commit 3fbe8a382c
2 changed files with 6 additions and 2 deletions

View File

@@ -14,4 +14,4 @@ RABBITMQ_USER=admin
RABBITMQ_PASS=password123
# JWT (生产环境务必修改为随机强密钥)
JWT_SECRET=change-me-in-production
JWT_SECRET=feedsystem-dev-secret-key

View File

@@ -59,6 +59,8 @@ services:
dockerfile: backend/Dockerfile
target: api
restart: always
environment:
JWT_SECRET: ${JWT_SECRET:-feedsystem-dev-secret-key}
ports:
- "8080:8080"
volumes:
@@ -72,7 +74,7 @@ services:
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- --post-data='{}' --header='Content-Type: application/json' http://localhost:8080/account/findByID || exit 1"]
test: ["CMD-SHELL", "pgrep api || exit 1"]
interval: 10s
timeout: 5s
retries: 3
@@ -83,6 +85,8 @@ services:
dockerfile: backend/Dockerfile
target: worker
restart: always
environment:
JWT_SECRET: ${JWT_SECRET:-feedsystem-dev-secret-key}
volumes:
- ./backend/configs/config.docker.yaml:/app/configs/config.yaml:ro
depends_on: