services:
  rg-website-cms:
    build: .
    container_name: rg-website-cms
    restart: unless-stopped
    ports:
      - "${PORT}:1337"
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: ${DATABASE_HOST}
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      DATABASE_SSL: ${DATABASE_SSL}
      NODE_ENV: ${NODE_ENV}
      HOST: ${HOST}
      PORT: ${PORT}
      APP_KEYS: ${APP_KEYS}
      API_TOKEN_SALT: ${API_TOKEN_SALT}
      ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
      JWT_SECRET: ${JWT_SECRET}
      TRANSFER_TOKEN_SALT: ${TRANSFER_TOKEN_SALT}
      CORS_ORIGIN: ${CORS_ORIGIN}
    volumes:
      - rg-website-cms_uploads:/app/public/uploads
      - rg-website-cms_data:/app/.tmp
    depends_on:
      - postgres
    networks:
      - rg-website-cms-network

  postgres:
    image: postgres:15-alpine
    container_name: rg-website-cms-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${DATABASE_NAME}
      POSTGRES_USER: ${DATABASE_USERNAME}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "${DATABASE_PORT}:5432"
    networks:
      - rg-website-cms-network

volumes:
  rg-website-cms_uploads:
  rg-website-cms_data:
  postgres_data:

networks:
  rg-website-cms-network:
    driver: bridge
