-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (47 loc) · 2.78 KB
/
Dockerfile
File metadata and controls
61 lines (47 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Build stage - compile extensions
FROM maven:3.9-eclipse-temurin-21 AS builder
# Install tools for fetching/building sources
RUN apt-get update && apt-get install -y git curl ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Build auto-username mapper
COPY auto-username/ ./auto-username/
RUN cd auto-username && mvn clean package -DskipTests
# Build magic-link authenticator
COPY magic-link/ ./magic-link/
RUN cd magic-link && mvn clean package -DskipTests
# Clone and build keycloak-orcid with Keycloak 26.5 compatibility patch
RUN git clone --depth 1 --branch 1.4.0 https://github.com/eosc-kc/keycloak-orcid.git && \
cd keycloak-orcid && \
sed -i 's/user\.setIdp(this);/\/\/ user.setIdp(this); \/\/ Removed for Keycloak 26.5+ compatibility/g' src/main/java/org/keycloak/social/orcid/OrcidIdentityProvider.java && \
mvn clean package -DskipTests
# Final stage
FROM quay.io/keycloak/keycloak:26.5
# Copy keycloak-orcid from builder
COPY --from=builder /build/keycloak-orcid/target/keycloak-orcid.jar /opt/keycloak/providers/
# Copy custom auto-username mapper
COPY --from=builder /build/auto-username/target/auto-username.jar /opt/keycloak/providers/
# Copy magic-link authenticator
COPY --from=builder /build/magic-link/target/magic-link.jar /opt/keycloak/providers/
# Copy Keycloakify theme JAR
COPY ./keycloakify/dist_keycloak/keycloak-theme-for-kc-all-other-versions.jar /opt/keycloak/providers/
# Copy realm configuration
COPY realm-config.json /opt/keycloak/data/import/realm-config.json
# Verify all providers are in place
RUN ls -la /opt/keycloak/providers/ && \
echo "Verifying extensions..." && \
ls -1 /opt/keycloak/providers/*.jar
# Build Keycloak with all providers (required for production)
# --metrics-enabled and --health-enabled are baked in so the optimised start
# does not trigger a "re-augmentation required" warning at runtime.
RUN /opt/keycloak/bin/kc.sh build \
--health-enabled=true --metrics-enabled=true
# Verify all extension JARs are present
RUN echo "============================================" && \
echo "Verifying installed extensions:" && \
ls -1 /opt/keycloak/providers/ && \
test -f /opt/keycloak/providers/keycloak-orcid.jar && echo "✓ ORCID Identity Provider" || (echo "✗ ORCID provider missing" && exit 1) && \
test -f /opt/keycloak/providers/auto-username.jar && echo "✓ Auto Username Mapper" || (echo "✗ Auto-username missing" && exit 1) && \
test -f /opt/keycloak/providers/magic-link.jar && echo "✓ Magic Link Authenticator" || (echo "✗ Magic Link missing" && exit 1) && \
test -f /opt/keycloak/providers/keycloak-theme-for-kc-all-other-versions.jar && echo "✓ Keycloakify Theme" || (echo "✗ Theme missing" && exit 1) && \
echo "============================================" && \
echo "All extensions installed successfully!"