Closed kbumsik closed 4 months ago
Hi,
Not sure on what you need support. But I can give you some hint on how to build a docker image with this patch.
1- You will need to build the keycloak-orgs
jar: (you need to have maven)
In the keycloak-orgs project on the branch having the patch, run the command mvn clean install
it should generate a target folder with keycloak-orgs-*-SNAPSHOT.jar
.
2- Once you have the .jar you can build a docker image. Here is an example of a Dockerfile:
FROM quay.io/phasetwo/phasetwo-keycloak:23.0.4 as builder
# Change these values to point to a running postgres instance
ENV KC_DB=YOUR_DB
RUN rm -r /opt/keycloak/providers/io.phasetwo.keycloak-keycloak-orgs-*
COPY ./JAR_FOLDER_PATH/*.jar /opt/keycloak/providers/
WORKDIR /opt/keycloak
# for demonstration purposes only, please make sure to use proper certificates in production instead
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
# build
RUN /opt/keycloak/bin/kc.sh --verbose build --spi-email-template-provider=freemarker-plus-mustache --spi-email-template-freemarker-plus-mustache-enabled=true --spi-theme-cache-themes=false
FROM quay.io/phasetwo/phasetwo-keycloak:23.0.4
COPY --from=builder /opt/keycloak/ /opt/keycloak/
ENV KC_PROXY_ADDRESS_FORWARDING=true
ENV KC_HOSTNAME_STRICT=true
ENV KC_HOSTNAME_STRICT_HTTPS=true
ENV KC_HOSTNAME=YOUR_HOSTNAME
ENV KC_PROXY=edge
ENV KC_DB=YOUR_DB
ENV KC_DB_URL=YOUR_DB_URI
ENV KC_DB_USERNAME=YOUR_DB_USERNAME
ENV KC_DB_PASSWORD=YOUR_DB_PASSWORD
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
Of course, you have to adjust the Dockerfile to your usage, you can have more info here
To build the image you can use: docker build -t registry/image-name:23.0.4 .
Thanks @MGLL
There are also some dependencies that need to be packaged. The phasetwo-containers Dockerfile and libs/pom.xml
will help you get started.
Hi, we are considering upgrading to a newer Keycloack version but I just came across this issue before upgrading. https://github.com/p2-inc/keycloak-orgs/issues/154
We would like to try the new patch, but we are Python/Go developers and we have been using the docker images, so we have no clue how to test the patch.
It would be great if there is an instruction to build a docker image locally.