services: postgres: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: fiscal volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d fiscal"] interval: 5s timeout: 5s retries: 10 networks: - fiscal backend: build: context: ./backend dockerfile: Dockerfile restart: unless-stopped environment: DATABASE_URL: postgres://postgres:postgres@postgres:5432/fiscal PORT: 3001 JWT_SECRET: change-this-to-a-random-secret-key GITHUB_ID: ${GITHUB_ID} GITHUB_SECRET: ${GITHUB_SECRET} GOOGLE_ID: ${GOOGLE_ID} GOOGLE_SECRET: ${GOOGLE_SECRET} depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "bun", "-e", "require('http').createServer(() => {}).listen(3001)"] interval: 30s timeout: 10s retries: 3 networks: - fiscal frontend: build: context: ./frontend dockerfile: Dockerfile restart: unless-stopped environment: NEXT_PUBLIC_API_URL: http://backend:3001 depends_on: - backend networks: - fiscal volumes: postgres_data: networks: fiscal: # Remove external: true to let Docker Compose create the network automatically # This is required for Coolify deployment where the network doesn't exist yet