|
| 1 | +ARG BASE_IMAGE_NAME="docker.io/bitnami/keycloak:24.0.2-debian-12-r0" |
| 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:c597a98f26fc4e7ab9a2e2a555113c8b91b8018f66946cc77a4224f1e595c95e" |
| 5 | + |
| 6 | +# Building builder image |
| 7 | +# hadolint ignore=DL3006 |
| 8 | +FROM ${BASE_IMAGE_NAME}@${BASE_IMAGE_DIGEST} as builder |
| 9 | +# use the .github/scripts/utils/get_aws_wrapper_version.sh keycloak-version script to get the value and pass it at build time |
| 10 | +ARG AWS_JDBC_WRAPPER_VERSION |
| 11 | + |
| 12 | +USER 0 |
| 13 | + |
| 14 | +# install maven (silence alert about version pinning of maven) |
| 15 | +# hadolint ignore=DL3008 |
| 16 | +RUN mkdir /home/keycloak && chown keycloak /home/keycloak && \ |
| 17 | + apt-get update && apt-get install maven -y --no-install-recommends |
| 18 | + |
| 19 | +USER 1001 |
| 20 | + |
| 21 | +WORKDIR /home/keycloak |
| 22 | + |
| 23 | +# download the wrapper from github, then fetch the dependencies from maven |
| 24 | +ADD --chown=1001 "https://github.com/awslabs/aws-advanced-jdbc-wrapper/releases/download/${AWS_JDBC_WRAPPER_VERSION}/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar" "/opt/bitnami/keycloak/providers/aws-advanced-jdbc-wrapper-${AWS_JDBC_WRAPPER_VERSION}.jar" |
| 25 | +ADD --chown=1001 "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" /home/keycloak/pom.xml |
| 26 | + |
| 27 | +RUN cat /home/keycloak/pom.xml && mvn install && \ |
| 28 | + cp /home/keycloak/.m2/repository/software/amazon/awssdk/*/*/*.jar /opt/bitnami/keycloak/providers/ |
| 29 | + |
| 30 | +RUN /opt/bitnami/keycloak/bin/kc.sh build |
| 31 | + |
| 32 | +##### FINAL Keycloak IMAGE ##### |
| 33 | + |
| 34 | +# hadolint ignore=DL3006 |
| 35 | +FROM ${BASE_IMAGE_NAME}@${BASE_IMAGE_DIGEST} |
| 36 | +# leave the values below unset to use the default value at the top of the file |
| 37 | +ARG BASE_IMAGE_NAME |
| 38 | +ARG BASE_IMAGE_DIGEST |
| 39 | + |
| 40 | +# use the .github/scripts/utils/get_aws_wrapper_version.sh keycloak-version script to get the value and pass it at build time |
| 41 | +ARG AWS_JDBC_WRAPPER_VERSION |
| 42 | + |
| 43 | +# Copy the previously built aws jdbc drivers |
| 44 | +COPY --from=builder /opt/bitnami/keycloak/ /opt/bitnami/keycloak/ |
| 45 | + |
| 46 | +# common, k8s, openshift and OCI labels: |
| 47 | +# OCI: https://github.com/opencontainers/image-spec/blob/main/annotations.md |
| 48 | +# OCP: https://docs.openshift.com/container-platform/4.10/openshift_images/create-images.html#defining-image-metadata |
| 49 | +LABEL maintainer="Camunda" \ |
| 50 | + name="camunda/keycloak" \ |
| 51 | + summary="Keycloak bitnami with AWS wrapper" \ |
| 52 | + io.k8s.description="Keycloak bitnami with AWS wrapper." \ |
| 53 | + io.k8s.display-name="keycloak" \ |
| 54 | + description="Keycloak bitnami with AWS JDBC wrapper." \ |
| 55 | + jdbc.aws-jdbc-wrapper.version="${AWS_JDBC_WRAPPER_VERSION}" \ |
| 56 | + org.opencontainers.image.authors="Camunda" \ |
| 57 | + org.opencontainers.image.vendor="Camunda" \ |
| 58 | + org.opencontainers.image.documentation="https://hub.docker.com/camunda/keycloak/" \ |
| 59 | + org.opencontainers.image.licenses="Apache License 2.0" \ |
| 60 | + org.opencontainers.image.base.name="docker.io/library/${BASE_IMAGE_NAME}" \ |
| 61 | + org.opencontainers.image.base.digest="${BASE_IMAGE_DIGEST}" \ |
| 62 | + io.openshift.tags="bpmn,identity,keycloak,camunda,bitnami" \ |
| 63 | + io.openshift.min-memory="1Gi" \ |
| 64 | + io.openshift.min-cpu="1" |
| 65 | + |
| 66 | + # cpu and ram allocation reference: https://www.keycloak.org/high-availability/concepts-memory-and-cpu-sizing |
| 67 | + |
| 68 | + # the following labels are generated at buildtime - see https://github.com/docker/metadata-action |
| 69 | + # org.opencontainers.image.title |
| 70 | + # org.opencontainers.image.description |
| 71 | + # org.opencontainers.image.url |
| 72 | + # org.opencontainers.image.created |
| 73 | + # org.opencontainers.image.revision |
| 74 | + # org.opencontainers.image.source |
| 75 | + # org.opencontainers.image.version |
0 commit comments