Skip to content
yaml
version: '3'

services:
  nginx:
    container_name: infisical-nginx
    image: nginx
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/default.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
    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_TEAM=${STRIPE_PRODUCT_TEAM}
      - 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:
nginx
server {
    listen 80;

    location /api {
        proxy_set_header X-Real-RIP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://backend:4000;
        proxy_redirect off;

        proxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
    }

    location / {
        include /etc/nginx/mime.types;

        proxy_set_header X-Real-RIP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_pass http://frontend:3000;
        proxy_redirect off;
    }
}