Skip to content

add correct route prefix #27

add correct route prefix

add correct route prefix #27

name: Docker Build and Push on Push
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME_BASE: ${{ github.repository }} # owner/repo
SERVICES: configurator autoscale dashboard incident feature-flags scheduler
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images
run: echo "Building services..."
build-configurator:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set lowercase IMAGE_NAME_BASE
run: echo "IMAGE_NAME_BASE=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set short SHA env var
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Extract Docker metadata for configurator
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/configurator
labels: org.opencontainers.image.source=${{ github.repository }}
- name: Build and push configurator image
uses: docker/build-push-action@v5
with:
context: .
file: ./configurator/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/configurator:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/configurator:${{ env.SHORT_SHA }}
labels: ${{ steps.meta.outputs.labels }}
build-images:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
service:
[autoscale, dashboard, incident, feature-flags, scheduler]
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set lowercase IMAGE_NAME_BASE
run: echo "IMAGE_NAME_BASE=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set short SHA env var
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Extract Docker metadata for ${{ matrix.service }}
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ matrix.service }}
labels: org.opencontainers.image.source=${{ github.repository }}
- name: Build and push ${{ matrix.service }} image
uses: docker/build-push-action@v5
with:
context: ./${{ matrix.service }}
file: ./${{ matrix.service }}/Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ matrix.service }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ matrix.service }}:${{ env.SHORT_SHA }}
labels: ${{ steps.meta.outputs.labels }}