Dockerfile for confluence

version: "3.2"
services:
  confluence-db:
    image: postgres:11-alpine
    container_name: confluence-db
    environment:
      - POSTGRES_PASSWORD=confluence
      - POSTGRES_USER=confluence
      - POSTGRES_DB=confluence
    volumes:
      - ./pgdata:/var/lib/postgresql/data
    networks:
      - confluence-db-network

  confluence-server:
    image: atlassian/confluence
    container_name: confluence-server
    environment:
      # Memory / Heap Size
      - JVM_MINIMUM_MEMORY=1024M
      - JVM_MAXIMUM_MEMORY=2048M
      - JVM_RESERVED_CODE_CACHE_SIZE=512M
      # Reverse Proxy Settings
      - ATL_PROXY_NAME=confluence.example.com
      - ATL_PROXY_PORT=443
      - ATL_TOMCAT_SCHEME=https
      - ATL_TOMCAT_SECURE=true
      # Database
      - ATL_JDBC_URL=jdbc:postgresql://confluence-db:5432/confluence
      - ATL_JDBC_USER=confluence
      - ATL_JDBC_PASSWORD=confluence
      - ATL_DB_TYPE=postgresql
      # Data Center configuration
      - ATL_CLUSTER_TYPE=multicast
      - ATL_CLUSTER_NAME=confluence-cluster
      - ATL_CLUSTER_ADDRESS=230.0.0.1
      - ATL_CLUSTER_TTL=32
      # Home Directories
      - CONFLUENCE_HOME=/opt/confluence-home
      - ATL_PRODUCT_HOME_SHARED=/opt/confluence-home-shared
    volumes:
      - type: bind
        source: /opt/confluence/confluence-home
        target: /opt/confluence-home
      - type: bind
        source: /opt/confluence/confluence-home-shared
        target: /opt/confluence-home-shared
    command: sh -c "/opt/atlassian/confluence/bin/start-confluence.sh -fg"
    labels:
      - traefik.enable=true
      - traefik.docker.network=proxy
      - traefik.http.routers.confluence.rule=Host(`confluence.example.com`)
      - traefik.http.routers.confluence.entrypoints=websecure
      - traefik.http.routers.confluence.tls=true
      - traefik.http.routers.confluence.tls.certresolver=letsencrypt
      - traefik.http.services.confluence.loadbalancer.server.port=8090
    depends_on:
      - confluence-db
    networks:
      - confluence-db-network
      - proxy

networks:
  confluence-db-network:
    name: confluence-db-network
  proxy:
    external: true