version: "2"
volumes:
  caddy_config:
  caddy_data:

networks:
  default:

services:
  ### CORE ###
  ## Webserver
  caddy:
    image: caddy:latest
    container_name: caddy
    restart: unless-stopped
    networks:
      - default
    ports:
      - 80:80
      - 443:443 # for https://example.com configs, 
    volumes:
      - caddy_config:/config
      - ./caddy/caddy.conf:/etc/caddy/Caddyfile
      - ./caddy:/srv

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

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