From 3747288fb4690ee5886b3fa06b7b68dbe74be44f Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Mon, 2 Dec 2024 13:57:42 +0100 Subject: [PATCH] chore(keycloakify): slight refactor of version targeting Using the vitest.config.ts route means we notice more quickly (through ts errors) if something in the interface changes. --- keycloak/keycloakify/Dockerfile | 12 ++---------- keycloak/keycloakify/README.md | 4 ++++ keycloak/keycloakify/vite.config.ts | 7 +++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/keycloak/keycloakify/Dockerfile b/keycloak/keycloakify/Dockerfile index d0b578fc8e..0db180db44 100644 --- a/keycloak/keycloakify/Dockerfile +++ b/keycloak/keycloakify/Dockerfile @@ -2,7 +2,6 @@ ARG NODE_VERSION=22 FROM node:${NODE_VERSION}-bookworm AS builder ARG KEYCLOAK_ORCID_VERSION=1.3.0 -ARG KEYCLOAK_MAJOR_VERSION=24 USER root @@ -20,16 +19,9 @@ RUN yarn install --immutable && \ COPY . . RUN yarn build-keycloak-theme -RUN if [ "$KEYCLOAK_MAJOR_VERSION" -le 25 ]; then \ - mv dist_keycloak/keycloak-theme-for-kc-22-to-25.jar loculus-theme.jar; \ - else \ - mv dist_keycloak/keycloak-theme-for-kc-all-other-versions.jar loculus-theme.jar; \ - fi -# You can set an explicit version in vite.config.ts, see docs here: -# https://docs.keycloakify.dev/targeting-specific-keycloak-versions -# But for now this was the easiest way; In the future once we migrated away from KC<25 we can just get rid if this entirely +RUN mv dist_keycloak/loculus-theme.jar loculus-theme.jar; -FROM alpine:3.19 +FROM alpine:3.20 RUN mkdir /output COPY --from=builder /app/keycloak-orcid*.jar /output/ COPY --from=builder /app/loculus-theme.jar /output/ diff --git a/keycloak/keycloakify/README.md b/keycloak/keycloakify/README.md index 41cc08eed6..af3b09b327 100644 --- a/keycloak/keycloakify/README.md +++ b/keycloak/keycloakify/README.md @@ -72,3 +72,7 @@ npm run build-keycloak-theme Note that by default Keycloakify generates multiple .jar files for different versions of Keycloak. You can customize this behavior, see documentation [here](https://docs.keycloakify.dev/targeting-specific-keycloak-versions). + +## Maintenance notes + +The produced theme jars are differ for different Keycloak versions. Targeting of versions happens in `vite.config.ts`. \ No newline at end of file diff --git a/keycloak/keycloakify/vite.config.ts b/keycloak/keycloakify/vite.config.ts index 2b588382bd..70e650ff06 100644 --- a/keycloak/keycloakify/vite.config.ts +++ b/keycloak/keycloakify/vite.config.ts @@ -9,6 +9,13 @@ export default defineConfig({ keycloakify({ accountThemeImplementation: "none", themeName: "loculus", + keycloakVersionTargets: { + // Keep up to date with keycloakify upgrades + // Requires changes for major versions of Keycloak + // See https://docs.keycloakify.dev/targeting-specific-keycloak-versions + "22-to-25": "loculus-theme.jar", + "all-other-versions": false + }, environmentVariables: [ { name: "PROJECT_NAME", default: "Loculus" }, { name: "REGISTRATION_TERMS_MESSAGE", default: "" }