Skip to content

ga

ga #4

Workflow file for this run

name: Build and Push Docker Images
on:
push:
branches:
- '**'
paths:
- '.github/workflows/docker-build.yml'
workflow_dispatch:
inputs:
services:
description: 'Services to build (comma-separated or "all")'
required: true
default: 'all'
type: choice
options:
- all
- keycloak
- keycloak-21.1.2
- keycloak-postgres-query
- kong-api-scripts
- postgresql-backup
- redis-backup
- sunbird-yugabyte-migrations
jobs:
build-push:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- name: keycloak
path: scripts/keycloak
- name: keycloak-21.1.2
path: scripts/keycloak-21.1.2
- name: keycloak-postgres-query
path: scripts/keycloak-postgres-query
- name: kong-api-scripts
path: scripts/kong-api-scripts
- name: postgresql-backup
path: scripts/postgresql-backup
- name: redis-backup
path: scripts/redis-backup
- name: sunbird-yugabyte-migrations
path: scripts/sunbird-yugabyte-migrations
steps:
- name: Checkout
if: ${{ github.event_name == 'push' || github.event.inputs.services == 'all' || contains(github.event.inputs.services, matrix.service.name) }}
uses: actions/checkout@v4
- name: Set lowercase owner
if: ${{ github.event_name == 'push' || github.event.inputs.services == 'all' || contains(github.event.inputs.services, matrix.service.name) }}
run: echo "OWNER_LC=${OWNER,,}" >> $GITHUB_ENV
env:
OWNER: ${{ github.repository_owner }}
- name: Set up Docker Buildx
if: ${{ github.event_name == 'push' || github.event.inputs.services == 'all' || contains(github.event.inputs.services, matrix.service.name) }}
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: ${{ github.event_name == 'push' || github.event.inputs.services == 'all' || contains(github.event.inputs.services, matrix.service.name) }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
if: ${{ github.event_name == 'push' || github.event.inputs.services == 'all' || contains(github.event.inputs.services, matrix.service.name) }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.service.path }}
platforms: linux/amd64
push: true
tags: ghcr.io/${{ env.OWNER_LC }}/${{ matrix.service.name }}:latest