Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrapulse committed Mar 17, 2024
0 parents commit c730251
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker-compose.yaml
README.md
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push: { branches: master }
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
with: { platforms: arm64 }
- uses: docker/setup-buildx-action@v3
with:
config-inline: |
[worker.oci]
max-parallelism = 2
driver-opts:
network=host
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository }}:latest
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Should be compatible with redhat/ubi9 | https://almalinux.org/blog/almalinux-container-images-update-full-rhel-ubi-compatibility/
FROM almalinux/9-base AS ubi-micro-build

# Preparing curl for final image so we can do internal healthchecks
RUN mkdir -p /mnt/rootfs
RUN dnf install --installroot /mnt/rootfs curl --releasever 9 --setopt instal_weak_deps=false --nodocs -y \
&& dnf --installroot /mnt/roofs clean all \
&& rpm --root /mnt/rootfs -e --nodeps setup


FROM quay.io/keycloak/keycloak:24.0 as builder

WORKDIR /opt/keycloak

# Enable health and metrics
ENV KC_HEALTH_ENABLED=true
ENV KC_METRICS_ENABLED=true

# Configure DB vendor
ENV KC_DB=mariadb

RUN /opt/keycloak/bin/kc.sh build


FROM quay.io/keycloak/keycloak:24.0

COPY --from=ubi-micro-build /mnt/rootfs /
COPY --from=builder /opt/keycloak /opt/keycloak

# To prevent the "Local access required" view
ENV KEYCLOAK_ADMIN=admin
ENV KEYCLOAK_ADMIN_PASSWORD=admin

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl --head -fsS http://localhost:8080/health/ready

ENTRYPOINT [ "/opt/keycloak/bin/kc.sh" ]
CMD [ "start", "--optimized", "--proxy-headers=xforwarded", "--http-enabled=true", "--hostname-strict=false" ]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO
53 changes: 53 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# A docker compose file for testing purposes
version: "3.9"

services:
app:
build: .
depends_on: [ db ]
ports:
- 127.0.0.1:8080:8080/tcp
environment:
- KC_DB_URL=jdbc:mariadb://db/keycloak
- KC_DB_USERNAME=keycloak
- KC_DB_PASSWORD=keycloak
labels:
- traefik.enable=true
- traefik.http.routers.keycloak.tls=true
- traefik.http.routers.keycloak.entrypoints=web,websecure
- traefik.http.routers.keycloak.rule=Host(`keycloak.localhost`)

db:
image: mariadb:11
healthcheck:
interval: 30s
retries: 3
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ]
timeout: 30s
environment:
- MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=true
- MARIADB_DATABASE=keycloak
- MARIADB_USER=keycloak
- MARIADB_PASSWORD=keycloak

proxy:
image: traefik:v2.11
command: |
--api.insecure=true
--providers.docker=true
--providers.docker.exposedbydefault=false
--log.level=WARNING
--accesslog=true
--entrypoints.web.address=:80
--entrypoints.websecure.address=:443
ports:
- 127.0.0.1:80:80/tcp
- 127.0.0.1:443:443/tcp
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
- traefik.enable=true
- traefik.http.routers.traefik-dashboard.tls=true
- traefik.http.routers.traefik-dashboard.entrypoints=web,websecure
- traefik.http.routers.traefik-dashboard.service=api@internal
- traefik.http.routers.traefik-dashboard.rule=Host(`traefik.localhost`)

0 comments on commit c730251

Please sign in to comment.