60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
branches-ignore:
|
|
- main
|
|
|
|
jobs:
|
|
setup:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
build_and_push:
|
|
runs-on: ubuntu-latest
|
|
needs: setup # Ensures `build_and_push` runs only if `setup` succeeds
|
|
env:
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
steps:
|
|
- name: Identify Repository
|
|
id: extract_repo
|
|
run: echo "::set-output name=repo_name::${GITHUB_REPOSITORY##*/}"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Setup Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
config-inline: |
|
|
[registry."centurion-version-control.default.svc.cluster.local:3000"]
|
|
http = true
|
|
insecure = true
|
|
|
|
- name: Auth to Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: centurion-version-control.default.svc.cluster.local:3000
|
|
username: ${{ secrets.CI_USER }}
|
|
password: ${{ secrets.CI_USER_TOKEN }}
|
|
|
|
- name: Pull db_activity_wrapper Image
|
|
run: |
|
|
docker pull centurion-version-control.default.svc.cluster.local:3000/centurion/system/db-activity-wrapper:latest
|
|
|
|
- name: Build and push Container Image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:${{ github.sha }}
|
|
centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:latest
|
|
build-args: |
|
|
CONTAINER_REGISTRY=centurion-version-control.default.svc.cluster.local:3000/centurion/system |