Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: "recursive"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down Expand Up @@ -90,3 +92,22 @@ jobs:
startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Extract metadata (tags, labels) for Docker (Email OTP)
id: meta-eotp
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-eotp

- name: Build and push (Email OTP)
uses: docker/build-push-action@v6
with:
context: ./container
file: ./container/Dockerfile.eotp
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try adding something like build-args: BASE_IMAGE=${{ steps.meta.outputs.tags[0] }} (I don't know if array indexing works, you might have to use an indexing function)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works without indexing, but I guess if we decide to add another tag to the first container it will break

build-args: BASE_IMAGE=${{ steps.meta.outputs.tags }}
platforms: ${{ env.PLATFORMS }}
push: >
${{ github.ref == format('refs/heads/{0}', env.PUBLISH_BRANCH) ||
startsWith(github.ref, 'refs/tags/') }}
tags: ${{ steps.meta-eotp.outputs.tags }}
labels: ${{ steps.meta-eotp.outputs.labels }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "container/keycloak-2fa-email-authenticator"]
path = container/keycloak-2fa-email-authenticator
url = https://github.com/mesutpiskin/keycloak-2fa-email-authenticator.git
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ aws ecr get-login-password --region REGION | podman login --username AWS --passw
podman push ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/example/keycloak:YYYY-MM-DD
```

## Email-based OTP

A second container is also available (`ecs-keycloak-eotp`) which supports email-based OTP using [keycloak-2fa-email-authenticator](https://github.com/mesutpiskin/keycloak-2fa-email-authenticator).

## Deployment

Import a HTTPS certificate to ACM.
Expand Down
12 changes: 12 additions & 0 deletions container/Dockerfile.eotp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG BASE_IMAGE=quay.io/keycloak/keycloak:latest

FROM maven:3.9-eclipse-temurin-21-alpine AS otp-build

COPY keycloak-2fa-email-authenticator/ /otp-email/
RUN cd /otp-email && \
mvn clean package

FROM $BASE_IMAGE AS target

COPY --from=otp-build /otp-email/target/keycloak-2fa-email-authenticator*.jar /opt/keycloak/providers/
RUN /opt/keycloak/bin/kc.sh build
1 change: 1 addition & 0 deletions container/keycloak-2fa-email-authenticator
Loading