部署优化
This commit is contained in:
@@ -36,19 +36,21 @@ services:
|
||||
- thebet365
|
||||
|
||||
api:
|
||||
image: thebet365-api:latest
|
||||
image: thebet365-api:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/api/Dockerfile
|
||||
container_name: thebet365-api
|
||||
env_file:
|
||||
- .env.docker
|
||||
- path: .env.docker
|
||||
required: false
|
||||
environment:
|
||||
DATABASE_URL: postgresql://thebet365:${POSTGRES_PASSWORD:-thebet365}@postgres:5432/thebet365
|
||||
REDIS_URL: redis://redis:6379
|
||||
PORT: 3000
|
||||
NODE_ENV: production
|
||||
UPLOAD_DIR: /app/uploads
|
||||
RUN_MIGRATIONS_ON_START: ${RUN_MIGRATIONS_ON_START:-false}
|
||||
volumes:
|
||||
- uploads_data:/app/uploads
|
||||
depends_on:
|
||||
@@ -58,34 +60,58 @@ services:
|
||||
condition: service_healthy
|
||||
expose:
|
||||
- '3000'
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
"node -e \"fetch('http://127.0.0.1:3000/api/health/ready').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\"",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 20s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- thebet365
|
||||
|
||||
player:
|
||||
image: thebet365-player:latest
|
||||
image: thebet365-player:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/player/Dockerfile
|
||||
container_name: thebet365-player
|
||||
depends_on:
|
||||
- api
|
||||
api:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- '${PLAYER_PORT:-8082}:80'
|
||||
- '${BIND_ADDR:-127.0.0.1}:${PLAYER_PORT:-8082}:80'
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'wget -q -O /dev/null http://127.0.0.1/ || exit 1']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 6
|
||||
start_period: 10s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- thebet365
|
||||
|
||||
admin:
|
||||
image: thebet365-admin:latest
|
||||
image: thebet365-admin:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/admin/Dockerfile
|
||||
container_name: thebet365-admin
|
||||
depends_on:
|
||||
- api
|
||||
api:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- '${ADMIN_PORT:-8081}:80'
|
||||
- '${BIND_ADDR:-127.0.0.1}:${ADMIN_PORT:-8081}:80'
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'wget -q -O /dev/null http://127.0.0.1/ || exit 1']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 6
|
||||
start_period: 10s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- thebet365
|
||||
|
||||
Reference in New Issue
Block a user