From 0f08ea2d6c5a79372ea5fda077ab63216122e7ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Palma?= Date: Sun, 22 Dec 2024 23:32:52 +0000 Subject: [PATCH] chore: production keycloak dockerfile --- deploy/Dockerfile.keycloak | 7 +++++++ docker-compose.dev.yaml | 13 +++++++++++++ docker-compose.yaml | 18 +++++++++++++++++- sso/.env.example | 9 +++++++++ sso/compose.yml | 13 ------------- 5 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 deploy/Dockerfile.keycloak create mode 100644 docker-compose.dev.yaml create mode 100644 sso/.env.example delete mode 100644 sso/compose.yml diff --git a/deploy/Dockerfile.keycloak b/deploy/Dockerfile.keycloak new file mode 100644 index 0000000..afa7c88 --- /dev/null +++ b/deploy/Dockerfile.keycloak @@ -0,0 +1,7 @@ +FROM quay.io/keycloak/keycloak:26.0.0 + +COPY sso/certs /etc/x509/https + +RUN /opt/keycloak/bin/kc.sh build + +ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start"] diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml new file mode 100644 index 0000000..fad63fd --- /dev/null +++ b/docker-compose.dev.yaml @@ -0,0 +1,13 @@ +services: + keycloak: + image: quay.io/keycloak/keycloak:26.0.0 + command: ["start-dev"] + container_name: keycloak + environment: + KC_BOOTSTRAP_ADMIN_USERNAME: admin + KC_BOOTSTRAP_ADMIN_PASSWORD: admin + KEYCLOAK_USER: admin + KEYCLOAK_PASSWORD: admin + KEYCLOAK_IMPORT: /tmp/realm-export.json + ports: + - 8080:8080 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index c507cb6..76b84c6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,4 +12,20 @@ services: context: . dockerfile: deploy/Dockerfile.nginx ports: - - "80:80" \ No newline at end of file + - "80:80" + + keycloak: + build: + context: . + dockerfile: deploy/Dockerfile.keycloak + container_name: keycloak + # read from .env file + env_file: "sso/.env" + environment: + KC_BOOTSTRAP_ADMIN_USERNAME: admin + KC_BOOTSTRAP_ADMIN_PASSWORD: admin + KEYCLOAK_USER: admin + KEYCLOAK_PASSWORD: admin + KEYCLOAK_IMPORT: /tmp/realm-export.json + ports: + - 8080:8080 \ No newline at end of file diff --git a/sso/.env.example b/sso/.env.example new file mode 100644 index 0000000..f03517d --- /dev/null +++ b/sso/.env.example @@ -0,0 +1,9 @@ +KEYCLOAK_ADMIN= +KEYCLOAK_ADMIN_PASSWORD= +KC_HOSTNAME= +KC_DB_URL= +KC_DB= +KC_DB_USERNAME= +KC_DB_PASSWORD= +KC_HTTPS_CERTIFICATE_FILE= +KC_HTTPS_CERTIFICATE_KEY_FILE= \ No newline at end of file diff --git a/sso/compose.yml b/sso/compose.yml deleted file mode 100644 index 35290ec..0000000 --- a/sso/compose.yml +++ /dev/null @@ -1,13 +0,0 @@ -services: - keycloak: - image: quay.io/keycloak/keycloak:26.0.0 - command: ["start-dev"] - container_name: keycloak - environment: - KC_BOOTSTRAP_ADMIN_USERNAME: admin - KC_BOOTSTRAP_ADMIN_PASSWORD: admin - KEYCLOAK_USER: admin - KEYCLOAK_PASSWORD: admin - KEYCLOAK_IMPORT: /tmp/realm-export.json - ports: - - 8080:8080