services:
  minishell:
    container_name: "minishell"
    # image: qemux/qemu-docker
    restart: always
    build:
      context: ./minishell
      dockerfile: Dockerfile

    cap_drop:
      - ALL
    cap_add:
      - SETGID
      - FSETID
      - SETUID

    # Prevents gaining new privileges
    devices:
      - /dev/kvm
    security_opt:
      - no-new-privileges

    networks:
      website_net:
        ipv4_address: "88.88.5.2"

    # volumes:
    #   - /home/victor/git/website/minishell/linux-minishell/alpine-custom.iso:/boot.iso

    # environment:
    #     DISK_SIZE: "1GB"
    #     RAM_SIZE: "500MB"
    #     ARGUMENTS: "-boot d"
    #     DEBUG: "1"
    #     BOOT_MODE: "legacy"
        # BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-virt-3.21.3-x86_64.iso"

    # networks:
    #   - website_net

  certbot:
    image: certbot/certbot
    container_name: "certbot-site"
    restart: always

    volumes:
      - ./certbot/conf:/etc/letsencrypt
      - ./certbot/www:/var/www/certbot

    command: certonly --webroot -w /var/www/certbot --force-renewal --email victorvobis@protonmail.com -d victorvobis.mooo.com --agree-tos

  nginx-site:
    container_name: "nginx-site"
    restart: always
    build:
      context: ./nginx
      dockerfile: Dockerfile

    volumes:
      - ./nginx/nginx.conf:/etc/nginc/nginx.conf
      - ./certbot/conf:/etc/letsencrypt
      - ./certbot/www:/var/www/certbot

    depends_on:
      - "minishell"
      - "website"
    networks:
      website_net:
        ipv4_address: "88.88.5.1"

    ports:
      - 8080:80

  website:
    container_name: "site"
    restart: always
    build:
      context: ./vvsite
      dockerfile: Dockerfile

    networks:
      website_net:
        ipv4_address: "88.88.5.3"

networks:
  website_net:
    # external: false
    # internal: true
    driver: bridge
    ipam:
      config:
        - subnet: "88.88.0.0/21"
