services:
  web:
    build: ./web
    container_name: newploit-web
    hostname: insecure.newploit.com
    ports:
      - "80:80"
      - "443:443"
    environment:
      DB_HOST: db
      DB_NAME: newploit
      DB_USER: root
      DB_PASS: toor
      JWT_SECRET: secret
      APP_ENV: production
    volumes:
      - ./web/www:/var/www/html
      - ./web/cgi-bin:/usr/lib/cgi-bin
    depends_on:
      - db
    networks:
      newploit:
        aliases:
          - insecure.newploit.com

  db:
    image: mariadb:10.11
    container_name: newploit-db
    ports:
      - "3306:3306"
    environment:
      MARIADB_ROOT_PASSWORD: toor
      MARIADB_DATABASE: newploit
      MARIADB_USER: dbuser
      MARIADB_PASSWORD: dbpass123
    volumes:
      - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    networks:
      - newploit

  ftp:
    image: delfer/alpine-ftp-server
    container_name: newploit-ftp
    ports:
      - "21:21"
      - "21000-21010:21000-21010"
    environment:
      USERS: "anonymous|anonymous"
      ADDRESS: insecure.newploit.com
    networks:
      - newploit

networks:
  newploit:
    driver: bridge
