version: "2"
volumes:
  caddy_config:
  caddy_data:

networks:
  default:
  theory_of_magic:
    external: true
  
  nextcloud:
    external: true

    ## minecraft networks
  ultron:
    external: true
  skynet:
    external: true
  minecraft:
    external: true
  artemis:
    external: true

services:
  ### CORE ###
  ## Webserver
  caddy:
    #image: caddy:latest
    build: ./caddy/_build
    container_name: caddy
    #user: "1001:1001"
    restart: unless-stopped
    networks:
      - default
      - ultron
      - skynet
      - minecraft
      - theory_of_magic
      - artemis
      - nextcloud
    ports:
      - 80:80
      - 443:443
    volumes:
      #- caddy_data:/data
      - caddy_config:/config
      - ./caddy/caddy.conf:/etc/caddy/Caddyfile
      - ./caddy:/srv
      - ./samba:/share
      - ./minecraft:/minecraft

  caddy-php:
    image: "php:7.2-fpm"
    container_name: caddy-php
    user: "1001:1001"
    restart: unless-stopped
    volumes:
      - ./caddy/:/srv
      - ./minecraft:/minecraft
    networks:
      - default
    environment:
      UID: 1001
      GID: 1001


  ### Features ###
  ## PostgresQL
  database:
    container_name: database
    user: "1001:1001"
    image: 'library/postgres:12.9'
    tty: true
    restart: unless-stopped
    networks:
      - default
      - nextcloud
    ports:
      - 5432:5432
    volumes:
      - "./postgres/data:/var/lib/postgresql/data/"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: CalemvirDraconian
      POSTGRES_DB: default_database

  gitea:
    container_name: gitea
    #user: "1001:1001"
    image: 'gitea/gitea:latest'
    restart: unless-stopped
    environment: 
      USER_UID: 1001
      USER_GID: 1001
    networks:
      - default
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    networks:
      - default
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80/tcp"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: 'eURdr1w13w4LNi2alZtlH1qiwuT5BBWL'
    volumes:
      - './pihole/etc-pihole/:/etc/pihole/'
      - './pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped