Skip to content

Commit

Permalink
Add example theme in integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sschnabe committed Dec 5, 2023
1 parent 5b177ed commit b1dbd2b
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Keycloak container image for Kokuwa.
- logs as json
- ispn cache
- preconfigured tag for realm import from directory `/realms` (see [job.yaml](/src/test/k3s/keycloak/job.yaml))
- [integration test](/src/test/k3s) with [k3s](https://k3s.io/)
- [integration test](/src/test/k3s) with [k3s](https://k3s.io/) and deployment of [example theme](/src/main/docker/themes/kokuwa)

## Why

Expand Down
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,21 @@
</arguments>
</configuration>
</execution>
<execution>
<id>docker-themes</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<arguments>
<argument>build</argument>
<argument>${project.build.directory}/docker</argument>
<argument>--tag=${image.name}:${image.tag}-themes</argument>
<argument>--target=themes</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<executable>docker</executable>
Expand Down Expand Up @@ -340,6 +355,7 @@
<dockerImages>
<dockerImage>${image.name}:${image.tag}-${image.tag.test}</dockerImage>
<dockerImage>${image.name}:${image.tag}-${image.tag.test}-import</dockerImage>
<dockerImage>${image.name}:${image.tag}-themes</dockerImage>
</dockerImages>
</configuration>
</plugin>
Expand Down
8 changes: 8 additions & 0 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,11 @@ ENV KC_DB=postgres KC_CACHE=local KC_LOG_CONSOLE_OUTPUT=json
COPY --from=keycloak-import /app /app
ENTRYPOINT ["java", "-XX:+ExitOnOutOfMemoryError", "-Dkc.home.dir=/app", "-jar", "/app/lib/quarkus-run.jar"]
CMD ["import", "--dir=/realms"]

###
### Themes
###

FROM docker.io/library/debian:stable-slim AS themes

COPY themes /themes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.login-pf body { background: DimGrey none; }
2 changes: 2 additions & 0 deletions src/main/docker/themes/kokuwa/login/theme.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
parent=keycloak
styles=css/login.css css/styles.css
1 change: 1 addition & 0 deletions src/test/k3s/test/keycloak/files/kokuwa-realm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "kokuwa-id",
"enabled": true,
"realm": "kokuwa",
"loginTheme": "kokuwa",
"attributes": {
"frontendUrl": "http://auth.kokuwa.127.0.0.1.nip.io:8080"
},
Expand Down
21 changes: 21 additions & 0 deletions src/test/k3s/test/keycloak/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ spec:
prometheus.io/port: "8080"
prometheus.io/path: /realms/master/metrics
spec:
initContainers:
- name: keycloak-themes
image: ${image.name}:${image.tag}-themes
imagePullPolicy: Never
command: [cp, -r, /themes/kokuwa, /app/themes]
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsNonRoot: true
readOnlyRootFilesystem: true
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop: [ALL]
volumeMounts:
- name: themes
mountPath: /app/themes
containers:
- name: keycloak
image: ${image.name}:${image.tag}-${image.tag.test}
Expand Down Expand Up @@ -60,6 +77,8 @@ spec:
volumeMounts:
- name: data
mountPath: /app/data
- name: themes
mountPath: /app/themes
- name: tmp
mountPath: /tmp
enableServiceLinks: false
Expand All @@ -68,5 +87,7 @@ spec:
volumes:
- name: data
emptyDir: {}
- name: themes
emptyDir: {}
- name: tmp
emptyDir: {}

0 comments on commit b1dbd2b

Please sign in to comment.