|
| 1 | +ARG BASE_IMAGE_NAME="docker.io/bitnami/keycloak:26.0.0-debian-12-r1" |
| 2 | +# List of all available images with associated sha: https://hub.docker.com/r/bitnami/keycloak/tags |
| 3 | +# Note: use the global image digest to make this image platform agnostic (see: https://github.com/camunda/zeebe/pull/14186) |
| 4 | +ARG BASE_IMAGE_DIGEST="sha256:6aadcb7f1af5f463ccd8acaed341bead98d0c968532cd99f950512c74345818b" |
| 5 | + |
| 6 | +# We use the identity image to copy the keycloak theme |
| 7 | +FROM docker.io/camunda/identity:latest@sha256:19ed5c6a1e2fde366092b5339023c86e66797f497f8efcac61c4de1ac254134b AS identity |
| 8 | + |
| 9 | +# Building builder image |
| 10 | +# hadolint ignore=DL3006 |
| 11 | +FROM ${BASE_IMAGE_NAME}@${BASE_IMAGE_DIGEST} AS builder |
| 12 | + |
| 13 | +# renovate: datasource=github-tags depName=aws/aws-advanced-jdbc-wrapper |
| 14 | +ARG AWS_JDBC_WRAPPER_VERSION=2.3.9 |
| 15 | + |
| 16 | +USER 0 |
| 17 | + |
| 18 | +# install maven (silence alert about version pinning of maven) |
| 19 | +# hadolint ignore=DL3008 |
| 20 | +RUN mkdir /home/keycloak && chown keycloak /home/keycloak && \ |
| 21 | + apt-get update && apt-get install maven -y --no-install-recommends |
| 22 | + |
| 23 | +COPY --from=identity /app/keycloak-theme/ /opt/bitnami/keycloak/themes/identity |
| 24 | +RUN chown 1001:1000 -R /opt/bitnami/keycloak/themes |
| 25 | + |
| 26 | +USER 1001 |
| 27 | + |
| 28 | +WORKDIR /home/keycloak |
| 29 | + |
| 30 | +# Install the custom providers |
| 31 | +# download the wrapper from github, then fetch the dependencies from maven |
| 32 | +RUN curl -fL "https://repo1.maven.org/maven2/software/amazon/jdbc/aws-advanced-jdbc-wrapper/${AWS_JDBC_WRAPPER_VERSION}/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.pom" \ |
| 33 | + -o /home/keycloak/pom.xml \ |
| 34 | + && chown 1001:1000 /home/keycloak/pom.xml \ |
| 35 | + && chmod 0644 /home/keycloak/pom.xml && \ |
| 36 | + |
| 37 | + cat /home/keycloak/pom.xml && mvn install && \ |
| 38 | + cp /home/keycloak/.m2/repository/software/amazon/*/*/*/*.jar /opt/bitnami/keycloak/providers/ && \ |
| 39 | + |
| 40 | + curl -fL "https://github.com/aws/aws-advanced-jdbc-wrapper/releases/download/${AWS_JDBC_WRAPPER_VERSION}/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar" \ |
| 41 | + -o /opt/bitnami/keycloak/providers/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar \ |
| 42 | + && chown 1001:1000 /opt/bitnami/keycloak/providers/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar \ |
| 43 | + && chmod 0644 /opt/bitnami/keycloak/providers/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar && \ |
| 44 | + |
| 45 | + ls -alh /opt/bitnami/keycloak/providers/ |
| 46 | + |
| 47 | + |
| 48 | +RUN /opt/bitnami/keycloak/bin/kc.sh build |
| 49 | + |
| 50 | +##### FINAL Keycloak IMAGE # #### |
| 51 | + |
| 52 | +# hadolint ignore=DL3006 |
| 53 | +FROM ${BASE_IMAGE_NAME}@${BASE_IMAGE_DIGEST} |
| 54 | +# leave the values below unset to use the default value at the top of the file |
| 55 | +ARG BASE_IMAGE_NAME |
| 56 | +ARG BASE_IMAGE_DIGEST |
| 57 | + |
| 58 | +# renovate: datasource=github-tags depName=aws/aws-advanced-jdbc-wrapper |
| 59 | +ARG AWS_JDBC_WRAPPER_VERSION=2.3.9 |
| 60 | + |
| 61 | +# Copy the previously built aws jdbc drivers |
| 62 | +COPY --chown=1001:1000 --from=builder /opt/bitnami/keycloak/ /opt/bitnami/keycloak/ |
| 63 | + |
| 64 | +COPY --chown=1001:1000 --from=builder /opt/bitnami/keycloak/themes/identity /opt/bitnami/keycloak/themes/identity |
| 65 | + |
| 66 | + |
| 67 | +# common, k8s, openshift and OCI labels: |
| 68 | +# OCI: https://github.com/opencontainers/image-spec/blob/main/annotations.md |
| 69 | +# OCP: https://docs.openshift.com/container-platform/4.10/openshift_images/create-images.html#defining-image-metadata |
| 70 | +LABEL maintainer="Camunda" \ |
| 71 | + name="camunda/keycloak" \ |
| 72 | + summary="Keycloak bitnami with AWS wrapper" \ |
| 73 | + io.k8s.description="Keycloak bitnami with AWS wrapper." \ |
| 74 | + io.k8s.display-name="keycloak" \ |
| 75 | + description="Keycloak bitnami with AWS JDBC wrapper." \ |
| 76 | + jdbc.aws-jdbc-wrapper.version="${AWS_JDBC_WRAPPER_VERSION}" \ |
| 77 | + org.opencontainers.image.authors="Camunda" \ |
| 78 | + org.opencontainers.image.vendor="Camunda" \ |
| 79 | + org.opencontainers.image.documentation="https://hub.docker.com/camunda/keycloak/" \ |
| 80 | + org.opencontainers.image.licenses="Apache License 2.0" \ |
| 81 | + org.opencontainers.image.base.name="docker.io/library/${BASE_IMAGE_NAME}" \ |
| 82 | + org.opencontainers.image.base.digest="${BASE_IMAGE_DIGEST}" \ |
| 83 | + io.openshift.tags="bpmn,identity,keycloak,camunda,bitnami" \ |
| 84 | + io.openshift.min-memory="1Gi" \ |
| 85 | + io.openshift.min-cpu="1" |
| 86 | + |
| 87 | + # cpu and ram allocation reference: https://www.keycloak.org/high-availability/concepts-memory-and-cpu-sizing |
| 88 | + |
| 89 | + # the following labels are generated at buildtime - see https://github.com/docker/metadata-action |
| 90 | + # org.opencontainers.image.title |
| 91 | + # org.opencontainers.image.description |
| 92 | + # org.opencontainers.image.url |
| 93 | + # org.opencontainers.image.created |
| 94 | + # org.opencontainers.image.revision |
| 95 | + # org.opencontainers.image.source |
| 96 | + # org.opencontainers.image.version |
0 commit comments