blob: e38782f35636135965eebd0374f2999c8bcadd08 [file] [log] [blame]
Nico Huberf4fbab52023-07-25 10:57:08 +00001ARG KC_TAG=22.0
2FROM quay.io/keycloak/keycloak:${KC_TAG} as builder
3
4# Enable health and metrics support
5ENV KC_HEALTH_ENABLED=true
6ENV KC_METRICS_ENABLED=true
7
8ARG KC_DB=
9RUN test "${KC_DB}" || { echo \${KC_DB} must be set!; exit 1; }
10
11WORKDIR /opt/keycloak
12# for demonstration purposes only, please make sure to use proper certificates in production instead
13RUN 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
14RUN /opt/keycloak/bin/kc.sh build
15
16
Nico Huber472cfc72023-07-25 14:20:55 +000017FROM registry.access.redhat.com/ubi9 AS ubi-micro-build
18RUN dnf install --releasever 9 --setopt install_weak_deps=false --nodocs -y util-linux
19
20
Nico Huberf4fbab52023-07-25 10:57:08 +000021FROM quay.io/keycloak/keycloak:${KC_TAG}
22
23COPY --from=builder /opt/keycloak/ /opt/keycloak/
Nico Huber472cfc72023-07-25 14:20:55 +000024COPY --from=ubi-micro-build /usr/lib64/libcap-ng.so.0* /usr/lib64/
25COPY --from=ubi-micro-build /usr/bin/setpriv /usr/bin
Nico Huberf4fbab52023-07-25 10:57:08 +000026
27USER root
28COPY entrypoint /sa-entrypoint
29RUN chmod 544 /sa-entrypoint
30
Nico Huberf4fbab52023-07-25 10:57:08 +000031ENTRYPOINT ["/bin/sh", "/sa-entrypoint"]
32CMD ["start", "--optimized"]