blob: 84c07ddad4232db077635d0f21a6b49d13b3942a [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
17FROM quay.io/keycloak/keycloak:${KC_TAG}
18
19COPY --from=builder /opt/keycloak/ /opt/keycloak/
20
21USER root
22COPY entrypoint /sa-entrypoint
23RUN chmod 544 /sa-entrypoint
24
25USER keycloak
26ENTRYPOINT ["/bin/sh", "/sa-entrypoint"]
27CMD ["start", "--optimized"]