version: '3'

services:
  nginx:
    container_name: infisical-nginx
    image: nginx
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/default.dev.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - frontend
      - backend
    networks:
      - infisical

  backend:
    container_name: infisical-backend
    restart: unless-stopped
    depends_on:
      - mongo
    image: infisical/backend
    command: npm run start
    env_file: .env
    environment:
      - NODE_ENV=production
    networks:
      - infisical

  frontend:
    container_name: infisical-frontend
    restart: unless-stopped
    depends_on:
      - backend
    image: infisical/frontend
    env_file: .env
    environment:
      # - NEXT_PUBLIC_POSTHOG_API_KEY=${POSTHOG_PROJECT_API_KEY}
      - INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED}
      - NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO}
      - NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER}
    networks:
      - infisical

  mongo:
    container_name: infisical-mongo
    image: mongo
    restart: always
    env_file: .env
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${MONGO_USERNAME}
      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_PASSWORD}
    volumes:
      - mongo-data:/data/db
    networks:
      - infisical

volumes:
  mongo-data:
    driver: local

networks:
  infisical:
