Nico Huber | f4fbab5 | 2023-07-25 10:57:08 +0000 | [diff] [blame] | 1 | ARG KC_TAG=22.0 |
| 2 | FROM quay.io/keycloak/keycloak:${KC_TAG} as builder |
| 3 | |
| 4 | # Enable health and metrics support |
| 5 | ENV KC_HEALTH_ENABLED=true |
| 6 | ENV KC_METRICS_ENABLED=true |
| 7 | |
| 8 | ARG KC_DB= |
| 9 | RUN test "${KC_DB}" || { echo \${KC_DB} must be set!; exit 1; } |
| 10 | |
| 11 | WORKDIR /opt/keycloak |
| 12 | # for demonstration purposes only, please make sure to use proper certificates in production instead |
| 13 | RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:idm.test.hfh-it.de,IP:192.168.44.11" -keystore conf/server.keystore |
| 14 | RUN /opt/keycloak/bin/kc.sh build |
| 15 | |
| 16 | |
Nico Huber | 472cfc7 | 2023-07-25 14:20:55 +0000 | [diff] [blame^] | 17 | FROM registry.access.redhat.com/ubi9 AS ubi-micro-build |
| 18 | RUN dnf install --releasever 9 --setopt install_weak_deps=false --nodocs -y util-linux |
| 19 | |
| 20 | |
Nico Huber | f4fbab5 | 2023-07-25 10:57:08 +0000 | [diff] [blame] | 21 | FROM quay.io/keycloak/keycloak:${KC_TAG} |
| 22 | |
| 23 | COPY --from=builder /opt/keycloak/ /opt/keycloak/ |
Nico Huber | 472cfc7 | 2023-07-25 14:20:55 +0000 | [diff] [blame^] | 24 | COPY --from=ubi-micro-build /usr/lib64/libcap-ng.so.0* /usr/lib64/ |
| 25 | COPY --from=ubi-micro-build /usr/bin/setpriv /usr/bin |
Nico Huber | f4fbab5 | 2023-07-25 10:57:08 +0000 | [diff] [blame] | 26 | |
| 27 | USER root |
| 28 | COPY entrypoint /sa-entrypoint |
| 29 | RUN chmod 544 /sa-entrypoint |
| 30 | |
Nico Huber | f4fbab5 | 2023-07-25 10:57:08 +0000 | [diff] [blame] | 31 | ENTRYPOINT ["/bin/sh", "/sa-entrypoint"] |
| 32 | CMD ["start", "--optimized"] |