103 lines
2.5 KiB
YAML
103 lines
2.5 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
user-login:
|
|
build:
|
|
context: ../..
|
|
dockerfile: services/user-service/user-login/Dockerfile
|
|
container_name: user-login
|
|
environment:
|
|
- RUST_LOG=info
|
|
- DATABASE_URL=postgres://postgres:postgres@user-db:5432/user_db
|
|
- REDIS_URL=redis://user-redis:6379/0
|
|
- SERVICE_NAME=user-login
|
|
- SERVICE_PORT=8080
|
|
- JWT_SECRET=${JWT_SECRET:-dev-secret-key}
|
|
ports:
|
|
- "8001:8080"
|
|
depends_on:
|
|
user-db:
|
|
condition: service_healthy
|
|
user-redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- user-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
user-register:
|
|
build:
|
|
context: ../..
|
|
dockerfile: services/user-service/user-register/Dockerfile
|
|
container_name: user-register
|
|
environment:
|
|
- RUST_LOG=info
|
|
- DATABASE_URL=postgres://postgres:postgres@user-db:5432/user_db
|
|
- REDIS_URL=redis://user-redis:6379/0
|
|
- SERVICE_NAME=user-register
|
|
- SERVICE_PORT=8080
|
|
ports:
|
|
- "8002:8080"
|
|
depends_on:
|
|
user-db:
|
|
condition: service_healthy
|
|
user-redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- user-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
user-db:
|
|
image: postgres:18.3-alpine3.23
|
|
container_name: user-db
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=user_db
|
|
volumes:
|
|
- user_postgres_data:/var/lib/postgresql/data
|
|
- ./migrations:/docker-entrypoint-initdb.d:ro
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- user-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d user_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
user-redis:
|
|
image: redis:8.6.2-alpine
|
|
container_name: user-redis
|
|
volumes:
|
|
- user_redis_data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- user-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
networks:
|
|
user-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
user_postgres_data:
|
|
user_redis_data:
|