Skip to content

Commit 9a969e6

Browse files
Merge pull request #50 from JavatoDev-com/49-keycloak-realm-export-setup-with-docker-compose
49 keycloak realm export setup with docker compose
2 parents 7bc87ee + f6604b6 commit 9a969e6

File tree

3 files changed

+2711
-1
lines changed

3 files changed

+2711
-1
lines changed

docker-compose/docker-compose.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: '3.6'
33
services:
44
keycloak_web:
55
image: quay.io/keycloak/keycloak:23.0.7
6+
# build: keycloak
67
container_name: keycloak_web
78
environment:
89
KC_DB: postgres
@@ -11,11 +12,13 @@ services:
1112
KC_DB_PASSWORD: password
1213
KEYCLOAK_ADMIN: admin
1314
KEYCLOAK_ADMIN_PASSWORD: password
14-
command: start-dev
15+
command: ["start-dev", "--import-realm"]
1516
depends_on:
1617
- keycloakdb
1718
ports:
1819
- 8080:8080
20+
volumes:
21+
- ./keycloak:/opt/keycloak/data/import
1922

2023
keycloakdb:
2124
image: postgres:15

docker-compose/keycloak/Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM quay.io/keycloak/keycloak:23.0.7
2+
3+
# Make the realm configuration available for import
4+
COPY ./realm-export.json /opt/keycloak_import/
5+
6+
# Import the realm and user
7+
RUN /opt/keycloak/bin/kc.sh import --optimized --file /opt/keycloak_import/realm-export.json
8+
9+
# The Keycloak server is configured to listen on port 8080
10+
EXPOSE 8080
11+
12+
# Import the realm on start-up
13+
CMD ["start-dev"]

0 commit comments

Comments
 (0)