name: royal-pop-accessory

services:
  postgres:
    image: postgres:16-alpine
    container_name: royal-pop-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-royalpop}
      POSTGRES_USER: ${POSTGRES_USER:-royalpop}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-royalpop_change_me}
    volumes:
      - royal_pop_postgres_data:/var/lib/postgresql/data

  api:
    image: goko/royal-pop/api:local-prod
    container_name: royal-pop-api
    restart: unless-stopped
    env_file:
      - ../Env/.env.production
    environment:
      DATABASE_URL: ${DATABASE_URL:-postgres://royalpop:${POSTGRES_PASSWORD:-royalpop_change_me}@postgres:5432/royalpop?sslmode=disable}
    expose:
      - "8081"
    depends_on:
      - postgres

  proxy:
    image: goko/royal-pop/proxy:local-prod
    container_name: royal-pop-proxy
    restart: unless-stopped
    depends_on:
      api:
        condition: service_started
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ../Env/origin.crt:/etc/nginx/certs/origin.crt:ro
      - ../Env/origin.key:/etc/nginx/certs/origin.key:ro

volumes:
  royal_pop_postgres_data:
