services:
  # ------------------------------
  # Serveur Nginx (reverse proxy)
  # ------------------------------
  proxy:
    image: nginx:alpine
    container_name: webapps-proxy
    restart: unless-stopped
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - juice-shop
      - webgoat
      - bwapp
      - nodegoat
      - vampi
    networks:
      - default

  # ------------------------------
  # NodeGoat
  # ------------------------------
  nodegoat-db:
    image: mongo:4.4
    container_name: nodegoat-db
    restart: unless-stopped
    volumes:
      - nodegoat-db-data:/data/db

  nodegoat:
    build: ./nodegoat
    container_name: nodegoat
    depends_on:
      - nodegoat-db
    environment:
      - DB_HOST=nodegoat-db
      - DB_PORT=27017
      - VIRTUAL_HOST=nodegoat.lab
    volumes:
      - nodegoat-data:/usr/src/app/data
    restart: unless-stopped

  # ------------------------------
  # Juice Shop
  # ------------------------------
  juice-shop:
    image: bkimminich/juice-shop
    container_name: juice-shop
    environment:
      - VIRTUAL_HOST=juice.lab
    restart: unless-stopped

  # ------------------------------
  # WebGoat
  # ------------------------------
  webgoat:
    image: webgoat/webgoat
    container_name: webgoat
    environment:
      - VIRTUAL_HOST=webgoat.lab
      - VIRTUAL_PORT=8080
      - TZ=Europe/Paris
      - WEBGOAT_CONTEXT_PATH=/WebGoat
    expose:
      - "8080"
      - "9090"
    volumes:
      - webgoat-data:/home/webgoat
    restart: unless-stopped

  # ------------------------------
  # bWAPP 
  # ------------------------------ 
  bwapp:
    image: raesene/bwapp
    container_name: bwapp
    environment:
      - VIRTUAL_HOST=bwapp.lab
    restart: unless-stopped
    volumes:
      - bwapp-data:/var/www/html
  
  # ------------------------------ 
  # VAmPI (Vulnerable API)
  # ------------------------------ 
  vampi:
    image: erev0s/vampi
    container_name: vampi
    environment:
      - VIRTUAL_HOST=vampi.lab
      - VIRTUAL_PORT=5000
    expose:
      - "5000"
    restart: unless-stopped

# ------------------------------
# Volumes
# ------------------------------
volumes:
  nodegoat-data:
  nodegoat-db-data:
  bwapp-data:
  webgoat-data: