services: postgresql: image: docker.io/library/postgres:16-alpine restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"] start_period: 20s interval: 30s retries: 5 timeout: 5s volumes: - database:/var/lib/postgresql/data environment: POSTGRES_USER: authentik POSTGRES_DB: authentik POSTGRES_PASSWORD: ${PG_PASS:?database password required} env_file: - .env server: image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG} restart: unless-stopped command: server environment: AUTHENTIK_POSTGRESQL__HOST: postgresql AUTHENTIK_POSTGRESQL__USER: authentik AUTHENTIK_POSTGRESQL__NAME: authentik AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} volumes: - ./data/media:/data/media - ./custom-templates:/templates env_file: - .env ports: - "127.0.0.1:9000:9000" - "127.0.0.1:9443:9443" depends_on: postgresql: condition: service_healthy worker: image: ghcr.io/goauthentik/server:${AUTHENTIK_TAG} restart: unless-stopped command: worker environment: AUTHENTIK_POSTGRESQL__HOST: postgresql AUTHENTIK_POSTGRESQL__USER: authentik AUTHENTIK_POSTGRESQL__NAME: authentik AUTHENTIK_POSTGRESQL__PASSWORD: ${PG_PASS} # Fixes ownership of the mounted dirs on start user: root volumes: - ./data/media:/data/media - ./certs:/certs - ./custom-templates:/templates env_file: - .env depends_on: postgresql: condition: service_healthy volumes: database: driver: local