Skip to content

Configurable Keycloak Docker image and setup scripts

License

Notifications You must be signed in to change notification settings

JeffersonLab/keycloak

Repository files navigation

keycloak Docker

Configurable Keycloak Docker image and bash setup scripts.



Overview

This project provides a docker image which extends the production-oriented keycloak and adds features for development and testing. The Jefferson Lab image sets up a Docker healthcheck and Docker entrypoint, installs client tools (see lib.sh), and adds some default configuration for the Jefferson Lab environment. The entrypoint integrates with the healthcheck such that the container is "healthy" only when keycloak is both running and configured. Configuration is supported via environment variables and a conventional directory named /container-entrypoint-initdb.d of bash scripts that can be overwritten by mounting a volume.

  • 1.x version based on Keycloak 20.x
  • 2.x version based on Keycloak 26.x

Quick Start with Compose

  1. Grab project
git clone https://github.com/JeffersonLab/keycloak
cd keycloak
  1. Launch Compose
docker compose up
  1. Navigate to admin console
http://localhost:8081/auth

Note: Login with username admin and password admin

Configure

Mount a volume at /container-entrypoint-initdb.d containing bash scripts to run, ordered by name ascending. See example.

Environment variables:

Name Description
KC_FRONTEND_URL Front end scheme, hostname, port, and relative path
KC_BACKEND_URL Back end scheme, hostname, port, and relative path
KC_HTTP_RELATIVE_PATH Relative path, probably must match KC_FRONTEND_URL and KC_BACKEND_URL
KC_BOOTSTRAP_ADMIN_USERNAME Admin username
KC_BOOTSTRAP_ADMIN_PASSWORD Admin password

Release

  1. Bump the version number in the VERSION file and commit and push to GitHub (using Semantic Versioning).
  2. The CD GitHub Action should run automatically invoking:
    • The Create release GitHub Action to tag the source and create release notes summarizing any pull requests. Edit the release notes to add any missing details.
    • The Publish docker image GitHub Action to create a new demo Docker image.