-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
33 lines (23 loc) · 1.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Use a base image with Java 17 and Maven installed
FROM maven:3.8.4-openjdk-17-slim AS builder
# Set the working directory
WORKDIR /app
# Install Git, apt-utils and other dependencies
RUN apt-get update && apt-get install -y git apt-utils
# Copy necessary files for building and starting keycloak
COPY generate-kc-certs.sh .env setup-kc-oid4vci.sh load_env.sh cert-config.txt kc_keystore.pkcs12 ./
# Download, unpack, and prepare Keycloak
RUN ./setup-kc-oid4vci.sh
# Base image for the runtime stage
FROM openjdk:17-jdk-slim
# Set the working directory
WORKDIR /opt/keycloak
# Copy the built Keycloak deployment from the build stage
COPY --from=builder /app/target /opt/keycloak/target
# Copy the environment variable file from the build stage
COPY --from=builder /app/.env /opt/keycloak/
# Copy the custom entrypoint script to the container and make it executable
COPY entrypoint.sh /opt/keycloak/entrypoint.sh
RUN chmod +x /opt/keycloak/entrypoint.sh
# Set the entry point
ENTRYPOINT ["sh", "/opt/keycloak/entrypoint.sh"]