Skip to content

Commit

Permalink
chore(keycloakify): slight refactor of version targeting
Browse files Browse the repository at this point in the history
Using the vitest.config.ts route means we notice more quickly (through ts errors) if something in the interface changes.
  • Loading branch information
corneliusroemer committed Dec 2, 2024
1 parent 0fdac51 commit 3747288
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
12 changes: 2 additions & 10 deletions keycloak/keycloakify/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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/
Expand Down
4 changes: 4 additions & 0 deletions keycloak/keycloakify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
7 changes: 7 additions & 0 deletions keycloak/keycloakify/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "" }
Expand Down

0 comments on commit 3747288

Please sign in to comment.