89 lines
2.2 KiB
YAML
89 lines
2.2 KiB
YAML
# Docker Compose tuned for Dokploy
|
|
# Deploy as: Compose application → Git provider → compose path:
|
|
# deploy/docker/docker-compose.dokploy.yml
|
|
#
|
|
# Set environment variables in the Dokploy UI (Environment tab).
|
|
# Dokploy writes them to .env next to this compose file.
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER:-media}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB:-media_cluster}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-media} -d $${POSTGRES_DB:-media_cluster}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- media-cluster
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- media-cluster
|
|
|
|
master-api:
|
|
build:
|
|
context: ../..
|
|
dockerfile: deploy/docker/Dockerfile.master-api
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
NODE_ENV: production
|
|
HOST: 0.0.0.0
|
|
PORT: 3000
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-media}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-media_cluster}
|
|
REDIS_URL: redis://redis:6379
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
# Host ports (avoid Dokploy UI on :3000)
|
|
ports:
|
|
- "3100:3000"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
networks:
|
|
- media-cluster
|
|
|
|
admin-ui:
|
|
build:
|
|
context: ../..
|
|
dockerfile: deploy/docker/Dockerfile.admin-ui
|
|
restart: unless-stopped
|
|
environment:
|
|
# Server-side rewrite target (Docker network)
|
|
NEXT_PUBLIC_API_URL: http://master-api:3000
|
|
depends_on:
|
|
- master-api
|
|
ports:
|
|
- "3101:3000"
|
|
networks:
|
|
- media-cluster
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
media-cluster:
|
|
driver: bridge
|