Skip to content

Commit

Permalink
Ci/build (#28) (#29)
Browse files Browse the repository at this point in the history
* update: Dockerfile to build image #24

* ci: create workflow to push keycloak with activated oid4vci to AWS ECR #24
  • Loading branch information
ArmandMeppa authored Apr 24, 2024
1 parent 0858e18 commit c389ae9
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: ci-cd

on:
push:
branches:
- main

env:
REGISTRY: 917848404243.dkr.ecr.eu-central-1.amazonaws.com
IMAGE_NAME: kcoid4vci
ECS_SERVICE: kcoid4vci
ECS_CLUSTER: kcoid4vci
ECS_TASK_DEFINITION: .aws/task-definition.json
CONTAINER_NAME: "app"

jobs:
build-deliver:
runs-on: ubuntu-latest

permissions:
packages: write
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Upload image to ECR
uses: appleboy/docker-ecr-action@master
with:
access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
repo: ${{ env.IMAGE_NAME }}
registry: ${{ env.REGISTRY }}
region: ${{ secrets.AWS_REGION }}
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ RUN git config --global http.postBuffer 524288000
RUN git clone --depth 1 https://github.com/keycloak/keycloak.git /tmp/keycloak
WORKDIR /tmp/keycloak

# Fetch and checkout the pull request branch
RUN git fetch origin pull/27931/head:pr/wistefan/27931 && \
git checkout pr/wistefan/27931

# Build Keycloak without running tests
RUN mvn clean install -DskipTests

# Unpack the distribution
RUN tar xzf ./quarkus/dist/target/keycloak-999.0.0-SNAPSHOT.tar.gz -C /opt
WORKDIR /opt/keycloak-999.0.0-SNAPSHOT



# Environment variables
ENV KEYCLOAK_ADMIN=admin
ENV KEYCLOAK_ADMIN_PASSWORD=admin
Expand Down

0 comments on commit c389ae9

Please sign in to comment.