diff --git a/CHECKS b/CHECKS new file mode 100644 index 0000000..8c0f020 --- /dev/null +++ b/CHECKS @@ -0,0 +1,5 @@ +WAIT=3 +TIMEOUT=3 +ATTEMPTS=5 + +/auth Welcome to Keycloak diff --git a/Dockerfile b/Dockerfile index f23bed7..ba3dae7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,9 @@ FROM jboss/keycloak:9.0.0 -EXPOSE 80:8080 +EXPOSE 8080 + +COPY . ${WORKDIR} + +COPY sbin/* /sbin/ + +ENTRYPOINT ["/sbin/dokku-entrypoint.sh"] diff --git a/README.md b/README.md index e4130e4..72480bd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # keycloak-dokku -See [gitea-experiment repository](https://gitlab.com/autonomic-cooperative/gitea-experiment) for deploy instructions. +See [gitea-experiment repository](https://gitlab.com/autonomic-cooperative/gitea-experiment) for more. diff --git a/app.json b/app.json index a20dbd3..8f30a12 100644 --- a/app.json +++ b/app.json @@ -1,9 +1,5 @@ { "name": "keycloak", "description": "Open Source Identity and Access Management", - "repository": "https://gitlab.com/autonomic-cooperative/keycloak-dokku", - "success_url": "/", - "dokku": { - "plugins": [] - } + "repository": "https://gitlab.com/autonomic-cooperative/keycloak-dokku" } diff --git a/sbin/dokku-entrypoint.sh b/sbin/dokku-entrypoint.sh new file mode 100755 index 0000000..09f6462 --- /dev/null +++ b/sbin/dokku-entrypoint.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu -o pipefail + +setup_root_user() { + set -eu + + if ! grep -q "$ADMIN_USER" /opt/jboss/keycloak/standalone/configuration/keycloak-add-user.json; then + if /opt/jboss/keycloak/bin/add-user-keycloak.sh -r master -u "$ADMIN_USER" -p "$ADMIN_PASS"; then + echo "=====> root user added" + else + echo "=====> Failed to add root user" + exit 1 + fi + fi +} + +main() { + set -eu + + setup_root_user +} + +main + +/usr/bin/entrypoint "$@"