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