Skip to content

Commit

Permalink
update to keycloak 18.x.x quarkus version
Browse files Browse the repository at this point in the history
Signed-off-by: Craig McClendon <[email protected]>
  • Loading branch information
XcrigX committed Dec 7, 2022
1 parent d82877c commit 7eb6199
Show file tree
Hide file tree
Showing 15 changed files with 924 additions and 981 deletions.
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,31 @@
# ----------------------------------------------------------------------------

# Build stage
FROM maven:3-jdk-11-slim AS build
FROM maven:3-openjdk-18-slim AS build
COPY pom.xml ./
COPY keycloak-config ./keycloak-config
COPY jboss-fhir-provider ./jboss-fhir-provider
COPY keycloak-extensions ./keycloak-extensions

RUN mvn -B clean package -DskipTests


# Package stage
FROM quay.io/keycloak/keycloak:18.0.0-legacy
FROM quay.io/keycloak/keycloak:18.0.2

# This can be overridden, but without this I've found the db vendor-detection in Keycloak to be brittle
ENV DB_VENDOR=H2
ENV KC_HEALTH_ENABLED=true

# Install custom providers
#RUN curl -sL https://github.com/aerogear/keycloak-metrics-spi/releases/download/2.5.3/keycloak-metrics-spi-2.5.3.jar -o /opt/keycloak/providers/keycloak-metrics-spi-2.5.3.jar

COPY --from=build keycloak-extensions/target/keycloak-extensions-*.jar /opt/keycloak/providers/

RUN /opt/keycloak/bin/kc.sh build --health-enabled=true

#for debug, show the config
RUN /opt/keycloak/bin/kc.sh show-config

#NOTE - This will run the server in developer mode. Production deployments should change 'start-dev' to 'start'
# and will require additional configuration. See: https://www.keycloak.org/server/configuration
ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start-dev"]

COPY --from=build keycloak-extensions/target/keycloak-extensions-*.jar /opt/jboss/keycloak/standalone/deployments/
COPY --from=build jboss-fhir-provider/target/jboss-modules/ /opt/jboss/keycloak/modules/system/layers/base/
RUN rm -rf /opt/jboss/keycloak/docs
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,21 @@ Published Docker images from this project:
* [alvearie/smart-keycloak](https://quay.io/repository/alvearie/smart-keycloak) extends the official Keycloak image with the `keycloak-extensions` and their dependencies
* [alvearie/keycloak-config](https://quay.io/repository/alvearie/keycloak-config) packages the `keycloak-config` module on top of `adoptopenjdk/openjdk11-openj9:ubi` (for configuring Keycloak realms)

**Warning** :
The `alvearie/smart-keycloak` image starts Keycloak in development mode. Non-test deployments will need to use their own Dockerfile which starts the Keycloak in production mode and will require further configuration. See the Keycloak guides for more information. https://www.keycloak.org/guides


By default, the `alvearie/smart-keycloak` image will behave identical to the Keycloak image from which it extends.
Here is an example for running the image with a keycloak username and password of admin/admin:

```
docker run -p 8080:8080 -p 8443:8443 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin alvearie/smart-keycloak
docker run -p 8080:8080 -p 8443:8443 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin alvearie/smart-keycloak
```

Once you have it running, execute the `alvearie/keycloak-config` image to create or update a Keycloak realm with SMART App Launch support.

By default, `alvearie/keycloak-config` will use the following environment variables to connect to Keycloak and configure the KEYCLOAK_REALM with SMART App Launch support for a FHIR server at FHIR_BASE_URL:
* KEYCLOAK_BASE_URL=http://host.docker.internal:8080/auth
* KEYCLOAK_BASE_URL=http://host.docker.internal:8080
* KEYCLOAK_USER=admin
* KEYCLOAK_PASSWORD=admin
* KEYCLOAK_REALM=test
Expand All @@ -85,7 +89,7 @@ Additionally, the default keycloak-config image will create a single Keycloak us
It is possible to override these environment variables via the command line (using the `-e` flag), or even to pass an entirely different configuration file by specifying a docker run command. For example, to update a Keycloak server that is listening on port 8081 of the docker host with a custom configuration, you could run a command like the following:

```
docker run -v /local/config/dir:/config -e KEYCLOAK_BASE_URL=http://host.docker.internal:8081/auth alvearie/keycloak-config -configFile config/keycloak-config.json
docker run -v /local/config/dir:/config -e KEYCLOAK_BASE_URL=http://host.docker.internal:8081 alvearie/keycloak-config -configFile config/keycloak-config.json
```

See https://github.com/Alvearie/keycloak-extensions-for-fhir/tree/main/keycloak-config/src/main/resources/config for the example configurations that are shipped with this image.
Expand Down
49 changes: 0 additions & 49 deletions jboss-fhir-provider/pom.xml

This file was deleted.

37 changes: 0 additions & 37 deletions jboss-fhir-provider/src/main/resources/modules.xml

This file was deleted.

4 changes: 2 additions & 2 deletions keycloak-config/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# > docker build . -f keycloak-config/Dockerfile

# Build stage
FROM maven:3-jdk-11-slim AS build
FROM maven:3-openjdk-18-slim AS build
COPY pom.xml ./
COPY keycloak-config ./keycloak-config

Expand All @@ -27,7 +27,7 @@ COPY --from=build --chown=1001:0 keycloak-config/target/dependency/* /jars/
COPY --from=build --chown=1001:0 keycloak-config/src/main/resources/config/keycloak-config.json /config/
COPY --from=build --chown=1001:0 keycloak-config/run.sh /

ENV KEYCLOAK_BASE_URL=http://host.docker.internal:8080/auth \
ENV KEYCLOAK_BASE_URL=http://host.docker.internal:8080 \
KEYCLOAK_REALM=test \
KEYCLOAK_USER=admin \
KEYCLOAK_PASSWORD=admin \
Expand Down
4 changes: 2 additions & 2 deletions keycloak-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<artifactId>commons-text</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"keycloak": {
"serverUrl": "http://keycloak:8080/auth",
"serverUrl": "http://keycloak:8080",
"adminUser": "${KEYCLOAK_USER}",
"adminPassword": "${KEYCLOAK_PASSWORD}",
"adminClientId": "admin-cli",
Expand Down
Loading

0 comments on commit 7eb6199

Please sign in to comment.