- Custom authenticator creates and logs in a guest user when the authorization request has guest=true; other requests get the login form - Scheduled task removes guests with no remaining sessions - Realm export with mancala-web PKCE client, guest role and guest-aware browser flow (verify profile disabled so guests are not asked for details) - Dockerfile building the extension into a Keycloak 26.7.5 image - Keycloak and Postgres in compose; nginx proxies auth.playmancala.app and rate limits the auth endpoint - Integration tests run the extension and realm in a Keycloak container
23 lines
841 B
Docker
23 lines
841 B
Docker
# Keycloak with the mancala extension and realm baked in.
|
|
# Build context: apps/keycloak
|
|
|
|
FROM maven:3.9.11-eclipse-temurin-21 AS extension
|
|
WORKDIR /build
|
|
COPY extension/pom.xml .
|
|
COPY extension/src src
|
|
RUN mvn -B -q package -Dmaven.test.skip=true
|
|
|
|
# Keep the Keycloak version in sync with keycloak.version in extension/pom.xml
|
|
FROM quay.io/keycloak/keycloak:26.7.5 AS builder
|
|
ENV KC_DB=postgres
|
|
ENV KC_HEALTH_ENABLED=true
|
|
COPY --from=extension /build/target/mancala-keycloak-extension.jar /opt/keycloak/providers/
|
|
RUN /opt/keycloak/bin/kc.sh build
|
|
|
|
FROM quay.io/keycloak/keycloak:26.7.5
|
|
COPY --from=builder /opt/keycloak/ /opt/keycloak/
|
|
# Imported on startup only if the realm does not exist yet.
|
|
COPY realm/mancala-realm.json /opt/keycloak/data/import/
|
|
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
|
|
CMD ["start", "--optimized", "--import-realm"]
|