services:
  caddy:
    image: caddy:2.11-alpine
    container_name: caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro,z
      - ./home:/srv/home/
      - caddy-data:/data
      - caddy-config:/config
    networks:
      - services

  stalwart:
    image: stalwartlabs/stalwart:v0.16-alpine
    container_name: stalwart
    restart: unless-stopped
    environment:
      - STALWART_PUBLIC_URL
      - OIDC_KEY
      - OIDC_SIGNATURE_KEY
    ports:
      - "25:25"
      - "465:465"
      - "993:993"
      - "4190:4190"
      - "127.0.0.1:8080:8080"
    volumes:
      - stalwart-etc:/etc/stalwart
      - stalwart-data:/var/lib/stalwart
    networks:
      - services

  bulwark:
    image: ghcr.io/bulwarkmail/webmail:latest
    container_name: bulwark
    restart: unless-stopped
    environment:
      - JMAP_SERVER_URL
      - SESSION_SECRET
      - SETTINGS_SYNC_ENABLED
      - ADMIN_PASSWORD
    volumes:
      - bulwark-settings:/app/data/settings
      - bulwark-config:/app/data/admin # rw during setup
#     - bulwark-config:/app/data/admin:ro # ro after setup
      - bulwark-state:/app/data/admin-state
      - bulwark-telemetry:/app/data/telemetry
    networks:
      - services
    depends_on:
      - stalwart

  gitea:
    image: docker.gitea.com/gitea:1.27.0
    container_name: gitea
    restart: unless-stopped
    environment:
      - USER_UID=1000
      - USER_GID=1000
    ports:
      - "22:22"
    volumes:
      - gitea-data:/data
    networks:
      - services

volumes:
  caddy-data:
  caddy-config:
  stalwart-etc:
  stalwart-data:
  bulwark-settings:
  bulwark-config:
  bulwark-state:
  bulwark-telemetry:
  gitea-data:

networks:
  services:
