Files
Lucky_Wheel/docker-compose.yml
T

106 lines
3.5 KiB
YAML
Raw Normal View History

2026-09-15 17:26:42 +03:30
version: '3.8'
2026-09-10 01:58:29 +03:30
services:
postgres:
2026-09-15 17:26:42 +03:30
image: docker.arvancloud.ir/postgres:15-alpine
2026-09-10 01:58:29 +03:30
container_name: lucky_wheel_postgres
environment:
2026-09-15 17:26:42 +03:30
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgrespassword}
POSTGRES_DB: ${POSTGRES_DB:-lucky_wheel}
2026-09-10 01:58:29 +03:30
ports:
2026-09-15 17:26:42 +03:30
- "${EXTERNAL_DB_PORT:-5432}:5432"
2026-09-10 01:58:29 +03:30
volumes:
- pg_data:/var/lib/postgresql/data
2026-09-15 17:26:42 +03:30
restart: unless-stopped
2026-09-10 01:58:29 +03:30
healthcheck:
2026-09-15 17:26:42 +03:30
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-lucky_wheel}"]
2026-09-10 01:58:29 +03:30
interval: 5s
timeout: 5s
2026-09-15 17:26:42 +03:30
retries: 12
2026-09-10 01:58:29 +03:30
redis:
2026-09-15 17:26:42 +03:30
image: docker.arvancloud.ir/redis:7-alpine
2026-09-10 01:58:29 +03:30
container_name: lucky_wheel_redis
restart: unless-stopped
volumes:
- redis_data:/data
healthcheck:
2026-09-15 17:26:42 +03:30
test: ["CMD", "redis-cli", "ping"]
2026-09-10 01:58:29 +03:30
interval: 5s
timeout: 5s
retries: 5
api:
build:
2026-09-15 17:26:42 +03:30
context: ./apps/api
dockerfile: Dockerfile
container_name: lucky_wheel_api
2026-09-15 17:26:42 +03:30
# Prisma connects on module init, so a not-yet-ready DB crash-loops the API.
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
2026-09-15 17:26:42 +03:30
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://postgres:postgrespassword@postgres:5432/lucky_wheel?schema=public}
- PORT=${PORT:-3000}
- NODE_ENV=production
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- JWT_USER_SECRET=${JWT_USER_SECRET:-lucky_wheel_user_jwt_super_secret_key_2026!}
- JWT_USER_EXPIRES_IN=${JWT_USER_EXPIRES_IN:-7d}
- JWT_ADMIN_ACCESS_SECRET=${JWT_ADMIN_ACCESS_SECRET:-lucky_wheel_admin_access_jwt_super_secret_key_2026!}
- JWT_ADMIN_ACCESS_EXPIRES_IN=${JWT_ADMIN_ACCESS_EXPIRES_IN:-1h}
- JWT_ADMIN_REFRESH_SECRET=${JWT_ADMIN_REFRESH_SECRET:-lucky_wheel_admin_refresh_jwt_super_secret_key_2026!}
- JWT_ADMIN_REFRESH_EXPIRES_IN=${JWT_ADMIN_REFRESH_EXPIRES_IN:-7d}
- CORS_ADMIN_ORIGIN=${CORS_ADMIN_ORIGIN:-http://localhost:5173}
- CORS_CLIENT_ORIGIN=${CORS_CLIENT_ORIGIN:-http://localhost:5174}
- STORAGE_DRIVER=${STORAGE_DRIVER:-local}
- STORAGE_LOCAL_ROOT=${STORAGE_LOCAL_ROOT:-./uploads}
- STORAGE_PUBLIC_URL=${STORAGE_PUBLIC_URL:-}
- SMS_DRIVER=${SMS_DRIVER:-mock}
- RAYGAN_SMS_USERNAME=${RAYGAN_SMS_USERNAME:-}
- RAYGAN_SMS_PASSWORD=${RAYGAN_SMS_PASSWORD:-}
- RAYGAN_SMS_LINE_NUMBER=${RAYGAN_SMS_LINE_NUMBER:-}
- RAYGAN_SMS_API_BASE_URL=${RAYGAN_SMS_API_BASE_URL:-https://api.raygansms.com}
# No host ports — Dokploy/Traefik routes by domain to container port 3000
expose:
- "3000"
restart: unless-stopped
# The bare name "api" is ambiguous on Dokploy's shared network (other stacks
# register it too), which made nginx dial the wrong containers. Use a unique alias.
networks:
default:
aliases:
- luckywheel-api
admin:
build:
2026-09-15 17:26:42 +03:30
context: ./apps/admin
dockerfile: Dockerfile
container_name: lucky_wheel_admin
2026-09-15 17:26:42 +03:30
# No host ports — Dokploy/Traefik routes by domain to container port 80
expose:
- "80"
restart: unless-stopped
depends_on:
- api
client:
build:
2026-09-15 17:26:42 +03:30
context: ./apps/client
dockerfile: Dockerfile
container_name: lucky_wheel_client
2026-09-15 17:26:42 +03:30
# No host ports — Dokploy/Traefik routes by domain to container port 80
expose:
- "80"
restart: unless-stopped
depends_on:
- api
volumes:
pg_data:
redis_data: