services: backend: build: context: ./backend dockerfile: Dockerfile container_name: sos-backend ports: - "${BACKEND_PORT:-8000}:8000" volumes: - ./backend/data:/app/data env_file: - .env environment: # Computed variables that depend on other variables can remain here or be moved to app logic. # For now, we construct URLs here using compose substitution (which uses .env values). - DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-sosuser}:${POSTGRES_PASSWORD:-sospassword}@${DB_HOST:-db}:${DB_PORT:-5432}/${POSTGRES_DB:-sosdb} - REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}/0 - TZ=${TZ:-Asia/Seoul} depends_on: - redis - db restart: unless-stopped db: image: postgres:${POSTGRES_VERSION:-15-alpine} container_name: sos-db env_file: - .env environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} - POSTGRES_DB=${POSTGRES_DB} - TZ=${TZ:-Asia/Seoul} volumes: - ./backend/data/postgres:/var/lib/postgresql/data ports: - "${DB_PORT:-5432}:5432" restart: unless-stopped redis: image: redis:${REDIS_VERSION:-alpine} container_name: sos-redis ports: - "${REDIS_PORT:-6379}:6379" env_file: - .env environment: - TZ=${TZ:-Asia/Seoul} volumes: - ./backend/data/redis:/data command: redis-server --appendonly yes restart: unless-stopped frontend: build: context: . dockerfile: Dockerfile container_name: sos-frontend ports: - "${FRONTEND_PORT:-3000}:80" env_file: - .env environment: - TZ=${TZ:-Asia/Seoul} depends_on: - backend restart: unless-stopped