Skip to content

[GENAI] Add deployment files including helm and docker to genai #18

[GENAI] Add deployment files including helm and docker to genai

[GENAI] Add deployment files including helm and docker to genai #18

Workflow file for this run

name: CI/CD Pipeline for Keycloak SPI
on:
push:
paths:
- ".github/workflows/keycloak-ci-cd.yml"
- 'server/keycloak/**'
- 'helm/keycloak/**'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: server/keycloak-service
WORKING_DIRECTORY: server/keycloak
HELM_NAMESPACE: team-breaking-build
HELM_RELEASE_NAME: recipefy-keycloak-service
CHART_PATH: ./helm/keycloak-spi
jobs:
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.WORKING_DIRECTORY }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Run Gradle Build
run: ./gradlew build --no-daemon
build:
name: Build and Push Docker Images
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Generate Docker Image Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: ./${{ env.WORKING_DIRECTORY }}
file: ./${{ env.WORKING_DIRECTORY }}/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
name: Deploy to Rancher with Helm
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Configure Kubernetes Context
uses: azure/k8s-set-context@v4
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBE_CONFIG }}
- name: Deploy Helm Chart
run: |
helm upgrade --install ${{ env.HELM_RELEASE_NAME }} ${{ env.CHART_PATH }} \
--namespace ${{ env.HELM_NAMESPACE }}