Last active
November 30, 2022 08:30
-
-
Save deangrant/7c4b209ff19b65a6bb0d35e972bf4b5d to your computer and use it in GitHub Desktop.
Dockerfile to deploy themes as an archive to Keycloak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest AS themes | |
ADD /themes /themes | |
WORKDIR /themes | |
RUN apk add openjdk11 && \ | |
jar cf custom.jar META-INF/ theme/ | |
# Example dockerfile from https://www.keycloak.org/server/containers. | |
FROM quay.io/keycloak/keycloak:latest as builder | |
ENV KC_HEALTH_ENABLED=true | |
ENV KC_METRICS_ENABLED=true | |
ENV KC_DB=postgres | |
COPY --from=themes /themes/custom.jar /opt/keycloak/providers/custom.jar | |
WORKDIR /opt/keycloak | |
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore | |
RUN /opt/keycloak/bin/kc.sh build | |
FROM quay.io/keycloak/keycloak:latest | |
COPY --from=builder /opt/keycloak/ /opt/keycloak/ | |
ENV KC_DB_URL=<DBURL> | |
ENV KC_DB_USERNAME=<DBUSERNAME> | |
ENV KC_DB_PASSWORD=<DBPASSWORD> | |
ENV KC_HOSTNAME=localhost | |
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment