version: '3.4'

services:
  oc-auth:
    image: 'oc-auth:latest'
    ports:
      - 8094:8080
    container_name: oc-auth
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.auth.entrypoints=web"
      - "traefik.http.routers.auth.rule=PathPrefix(`/auth`)"
      - "traefik.http.middlewares.auth-rewrite.replacepathregex.regex=^/auth(.*)"
      - "traefik.http.middlewares.auth-rewrite.replacepathregex.replacement=/oc$$1"
      - "traefik.http.routers.auth.middlewares=auth-rewrite"
      - "traefik.http.services.auth.loadbalancer.server.port=8080"
      - "traefik.http.middlewares.auth.forwardauth.address=http://oc-auth:8080/oc/forward"
    environment:
          LDAP_ENDPOINTS: ldap:389
          LDAP_BINDDN: cn=admin,dc=example,dc=com
          LDAP_BINDPW: password
          LDAP_BASEDN: "dc=example,dc=com"
          LDAP_ROLE_BASEDN: "ou=AppRoles,dc=example,dc=com"
    networks: 
      - oc
    volumes:
      - ./pem/private.pem:/keys/private/private.pem
      - ./pem/public.pem:/keys/public/public.pem
networks: 
  oc:
    external: true