Skip to content

Commit

Permalink
Moved server-x container to https://github.com/keycloak/keycloak/tree…
Browse files Browse the repository at this point in the history
…/main/quarkus/container. Updated tags for legacy distribution to include :legacy

Closes keycloak#370
  • Loading branch information
stianst committed Jan 31, 2022
1 parent 5df2de0 commit 29f9aa3
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 172 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/ci.yaml

This file was deleted.

13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

Keycloak is an Open Source Identity and Access Management solution for modern Applications and Services.

This repository contains Docker images related to Keycloak.
This repository contains Docker images related to the legacy WildFly distribution of Keycloak.

- [keycloak](https://hub.docker.com/r/jboss/keycloak) Keycloak server
- [keycloak-adapter-wildfly](https://hub.docker.com/r/jboss/keycloak-adapter-wildfly) WildFly including Keycloak adapter


## Help and Documentation
Expand All @@ -30,9 +29,15 @@ Please remember to provide a good summary, description as well as steps to repro

To run Keycloak, run:

docker run jboss/keycloak
docker run quay.io/keycloak/keycloak

Or, to run the legacy WildFly distribution, run:

docker run quay.io/keycloak/keycloak:legacy

For more details refer to the [container guide](https://www.keycloak.org/server/container).

For more details refer to the [Keycloak server image documentation](server/README.md).
Or, for the legacy WildFly distribution refer to the [Keycloak server image documentation](server/README.md).


## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-mariadb-jdbc-ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
healthcheck:
test: ["CMD", "mysqladmin", "ping", "--silent"]
keycloak:
image: quay.io/keycloak/keycloak:latest
image: quay.io/keycloak/keycloak:legacy
environment:
DB_VENDOR: mariadb
DB_ADDR: mariadb
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- mssql
command: /bin/bash -c 'until /opt/mssql-tools/bin/sqlcmd -S mssql -U sa -P "Password!23" -Q "create database Keycloak"; do sleep 5; done'
keycloak:
image: quay.io/keycloak/keycloak:latest
image: quay.io/keycloak/keycloak:legacy
depends_on:
- mssql
- mssqlscripts
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
MYSQL_USER: keycloak
MYSQL_PASSWORD: password
keycloak:
image: quay.io/keycloak/keycloak:latest
image: quay.io/keycloak/keycloak:legacy
environment:
DB_VENDOR: MYSQL
DB_ADDR: mysql
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-oracle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
ports:
- 1521:1521
keycloak:
image: quay.io/keycloak/keycloak:latest
image: quay.io/keycloak/keycloak:legacy
environment:
DB_VENDOR: ORACLE
DB_ADDR: oracle
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-postgres-jdbc-ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
- 3000:8080

keycloak:
image: jboss/keycloak
image: jboss/keycloak:legacy
environment:
DB_VENDOR: postgres
DB_ADDR: postgres
Expand Down
2 changes: 1 addition & 1 deletion docker-compose-examples/keycloak-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
keycloak:
image: quay.io/keycloak/keycloak:latest
image: quay.io/keycloak/keycloak:legacy
environment:
DB_VENDOR: POSTGRES
DB_ADDR: postgres
Expand Down
2 changes: 1 addition & 1 deletion openshift-examples/keycloak-https-mutual-tls.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"containers": [
{
"name": "${APPLICATION_NAME}",
"image": "quay.io/keycloak/keycloak:latest",
"image": "quay.io/keycloak/keycloak:legacy",
"livenessProbe": {
"failureThreshold": 3,
"httpGet": {
Expand Down
2 changes: 1 addition & 1 deletion openshift-examples/keycloak-https.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"containers": [
{
"name": "${APPLICATION_NAME}",
"image": "quay.io/keycloak/keycloak:latest",
"image": "quay.io/keycloak/keycloak:legacy",
"livenessProbe": {
"failureThreshold": 3,
"httpGet": {
Expand Down
1 change: 0 additions & 1 deletion server-x/.gitignore

This file was deleted.

34 changes: 0 additions & 34 deletions server-x/Dockerfile

This file was deleted.

87 changes: 2 additions & 85 deletions server-x/README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,3 @@
# Keycloak.X Docker Image
# Keycloak Quarkus distribution image

The `Dockerfile` for Keycloak.X Docker Image.

See the `Build` section for more details on how to build the image.

Once built, you can run the server in the same manner as when using the Keycloak.X distribution by passing any command-line argument:

docker run --name keycloak -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me \
IMAGE[:TAG] \
start-dev
## Extending the Image

To customize the base image, create a new `Dockerfile` similar to following:

```
FROM quay.io/keycloak/keycloak-x
WORKDIR /opt/keycloak
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
```

In the example above, you are basically creating a new image `FROM` this image and adding a Java Keystore to configure HTTPS using a self-signed certificate (only for example purposes, never do that for production).

As another example, you can install any custom provider you may have (include themes within a JAR file) as follows:

```
FROM quay.io/keycloak/keycloak-x
COPY my-providers/ /opt/keycloak/providers/
WORKDIR /opt/keycloak
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
# Run the build command to install custom providers
RUN ./bin/kc.sh build
```

In the example above, any JAR files within the directory `my-providers` will be copied to the image's `/opt/keycloak/providers` directory. Then the `build` command is executed to install the custom providers.

For last, you can configure the server using any configuration option available as follows:

```
FROM quay.io/keycloak/keycloak-x
COPY my-providers/ /opt/keycloak/providers/
WORKDIR /opt/keycloak
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
RUN ./bin/kc.sh build --db=postgres --db-url=jdbc:postgresql://$DB_HOST/keycloak --db-username=keycloak --db-password=password
```

In the example above, the configuration is being set to use a PostgreSQL database.

NOTE: Note that we are using separated `RUN` steps for illustrative purposes, ideally you should reduce the number of layers and execute both steps in a single one.

## Auto-Build

Given the immutability of containers, you can use the `--auto-build` option in order to apply any configuration when running a new container. Once the container is created, subsequent restarts will never go through the configuration phase again but just start the server with the configuration previously defined.

docker run --name keycloak -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me \
IMAGE[:TAG] \
--auto-build --db=postgres -Dkc.db.url.host=<DB_HOST> --db-username=keycloak --db-password=change_me --http-enabled=true

The command above should be enough to run a server using a PostgreSQL database listening on a given `DB_HOST`.

The recommended approach should be to create your own image from this one and configure it accordingly to your needs. The `--auto-build` is intended for helping to get a running server with different options without having to create your own image, with the cost that every time you run a new container, the build step will run and your container will take longer to start.

However, the `--auto-build` option should help when trying out Keycloak and for development purposes.

## Build

It is possible to download the Keycloak distribution from a URL:

docker build --build-arg KEYCLOAK_DIST=http://<HOST>:<PORT>/keycloak.x-<VERSION>.tar.gz . -t <TAG>

For Keycloak built locally you need to copy the distribution to the local `server-x` folder:

cp $KEYCLOAK_SOURCE/distribution/server-x/target/keycloak.x-<VERSION>.tar.gz .
docker build --build-arg KEYCLOAK_DIST=keycloak.x-<VERSION>.tar.gz . -t <TAG>
Moved to https://github.com/keycloak/keycloak/tree/main/quarkus/container
Loading

0 comments on commit 29f9aa3

Please sign in to comment.