binary1ne commited on
Commit
e2ea758
·
verified ·
1 Parent(s): 2f2998a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -10
Dockerfile CHANGED
@@ -1,25 +1,40 @@
1
- # Use the official Keycloak image
 
 
2
  FROM quay.io/keycloak/keycloak:25.0.6 as builder
3
-
4
- # Build with in-memory database support
5
  RUN /opt/keycloak/bin/kc.sh build
6
 
7
- # Final lightweight image
 
 
8
  FROM quay.io/keycloak/keycloak:25.0.6
9
 
10
- # Copy the build artifacts
11
  COPY --from=builder /opt/keycloak/ /opt/keycloak/
12
 
13
- # Expose Hugging Face allowed port
 
 
 
 
 
 
 
 
 
 
 
14
  EXPOSE 7860
15
 
16
- # Set environment variables for admin user
17
  ENV KEYCLOAK_ADMIN=admin
18
  ENV KEYCLOAK_ADMIN_PASSWORD=admin
19
 
20
- # Start Keycloak in production mode with dev-mem DB
21
  ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start", \
22
- "--http-port=7860", \
 
 
23
  "--hostname-strict=false", \
24
  "--hostname-strict-https=false", \
25
- "--db=dev-mem" ]
 
1
+ # -----------------
2
+ # Build Keycloak
3
+ # -----------------
4
  FROM quay.io/keycloak/keycloak:25.0.6 as builder
 
 
5
  RUN /opt/keycloak/bin/kc.sh build
6
 
7
+ # -----------------
8
+ # Final image
9
+ # -----------------
10
  FROM quay.io/keycloak/keycloak:25.0.6
11
 
12
+ # Copy built Keycloak
13
  COPY --from=builder /opt/keycloak/ /opt/keycloak/
14
 
15
+ # Install openssl to generate self-signed certs
16
+ USER root
17
+ RUN microdnf install -y openssl && microdnf clean all
18
+
19
+ # Generate self-signed cert
20
+ RUN mkdir -p /opt/keycloak/certs && \
21
+ openssl req -x509 -newkey rsa:4096 -keyout /opt/keycloak/certs/key.pem -out /opt/keycloak/certs/cert.pem -days 365 -nodes -subj "/CN=localhost"
22
+
23
+ # Switch back to Keycloak user
24
+ USER 1000
25
+
26
+ # Expose Hugging Face port
27
  EXPOSE 7860
28
 
29
+ # Set admin credentials
30
  ENV KEYCLOAK_ADMIN=admin
31
  ENV KEYCLOAK_ADMIN_PASSWORD=admin
32
 
33
+ # Start Keycloak with HTTPS only on port 7860
34
  ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start", \
35
+ "--https-port=7860", \
36
+ "--https-certificate-file=/opt/keycloak/certs/cert.pem", \
37
+ "--https-certificate-key-file=/opt/keycloak/certs/key.pem", \
38
  "--hostname-strict=false", \
39
  "--hostname-strict-https=false", \
40
+ "--db=dev-mem"]