Docker Build #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
PIPELINE_MANAGER_IMAGE: ghcr.io/${{ github.repository_owner }}/pipeline-manager | |
KAFKA_CONNECT_IMAGE: ghcr.io/${{ github.repository_owner }}/kafka-connect | |
jobs: | |
build-and-push-image: | |
runs-on: [self-hosted, skylake40] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Docker meta (pipeline-manager) | |
id: meta_pipeline_manager | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.PIPELINE_MANAGER_IMAGE }} | |
tags: | | |
type=semver,pattern={{version}} | |
- name: Docker meta (kafka-connect) | |
id: meta_kafka_connect | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.KAFKA_CONNECT_IMAGE }} | |
tags: | | |
type=semver,pattern={{version}} | |
- name: Build Kafka Connect container | |
run: | | |
cd deploy && \ | |
docker build -f Dockerfile.kafka-connect --target kafka-connect -t ${{ env.KAFKA_CONNECT_IMAGE }} . | |
- name: Run standard demo that checks a couple endpoints are reachable | |
run: | | |
RUST_LOG=debug,tokio_postgres=info docker compose -f deploy/docker-compose.yml \ | |
-f deploy/docker-compose-dev.yml \ | |
-f deploy/docker-compose-extra.yml \ | |
-f deploy/docker-compose-demo.yml \ | |
--profile demo-standard up --build --force-recreate \ | |
--exit-code-from demo-standard --renew-anon-volumes | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Push untagged images when the workflow is not triggered by a release | |
- name: Push containers | |
if: github.event_name != 'release' | |
run: docker push ${{ env.PIPELINE_MANAGER_IMAGE }} && docker push ${{ env.KAFKA_CONNECT_IMAGE }} | |
# Tagged pipeline-manager image | |
- name: Push (pipeline-manager) | |
uses: docker/build-push-action@v4 | |
if: github.event_name == 'release' | |
with: | |
context: . | |
file: deploy/Dockerfile | |
push: true | |
tags: ${{ steps.meta_pipeline_manager.outputs.tags }} | |
labels: ${{ steps.meta_pipeline_manager.outputs.labels }} | |
- uses: actions/delete-package-versions@v4 | |
with: | |
package-name: pipeline-manager | |
package-type: 'container' | |
min-versions-to-keep: 5 | |
delete-only-untagged-versions: 'true' |