# docker-compose.yml (root) version: "3.9" x-env: &api_env NODE_ENV: production PORT: "8080" DATABASE_URL: postgres://app:app@postgres:5432/skymoney services: postgres: image: postgres:15 environment: POSTGRES_DB: skymoney POSTGRES_USER: app POSTGRES_PASSWORD: app volumes: - pgdata:/var/lib/postgresql/data restart: unless-stopped api: build: context: ./api dockerfile: Dockerfile environment: <<: *api_env depends_on: - postgres expose: - "8080" restart: unless-stopped # OPTIONAL: build web and serve with Caddy web: # If you want Compose to build your Vite app automatically: image: node:20-alpine working_dir: /app volumes: - ./web:/app - webdist:/build-out command: > sh -c "npm ci && npm run build && rm -rf /build-out/* && cp -r dist/* /build-out/" environment: # If your web build needs an API base url: - VITE_API_BASE=/api depends_on: - api # This runs once at up; to rebuild, `docker compose up -d --build web` restart: "no" caddy: image: caddy:2 ports: - "80:80" - "443:443" volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro - caddydata:/data - caddyconfig:/config # Serve built web files (if using web service above) - webdist:/srv/site depends_on: - api restart: unless-stopped volumes: pgdata: caddydata: caddyconfig: webdist: