Skip to content

build-container-images #81

build-container-images

build-container-images #81

---
name: build-container-images
on:
workflow_dispatch:
pull_request:
paths:
- 'argo-workflows/*/containers/*'
- 'argo-workflows/*/code/**'
- '!argo-workflows/example-feature/**'
push:
branches:
- main
paths:
- 'argo-workflows/*/containers/*'
- 'argo-workflows/*/code/**'
- '!argo-workflows/example-feature/**'
# bump container versions here, they will be populated to tags and labels
env:
VERSION_PYTHON311: 0.0.1
VERSION_PYTHON312: 0.0.1
VERSION_PYTHON_IRONIC: 0.0.4
VERSION_ARGO_UTILS: 0.0.1
VERSION_OBM_UTILS: 0.0.1
VERSION_PYTHON_NAUTOBOT_INT_SYNC: 0.0.1
VERSION_PYTHON_NAUTOBOT: 0.0.1
jobs:
build-ghcr-registry:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to ghcr.io
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and deploy Python 3.11 image
uses: docker/build-push-action@v5
with:
context: argo-workflows/generic/
file: argo-workflows/generic/containers/Dockerfile.python311_alpine
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/argo-python3.11.8-alpine3.19:latest,ghcr.io/rackerlabs/understack/argo-python3.11.8-alpine3.19:${{ env.VERSION_PYTHON311 }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_PYTHON311 }}
- name: Build and deploy Python 3.12 image
uses: docker/build-push-action@v5
with:
context: argo-workflows/generic/
file: argo-workflows/generic/containers/Dockerfile.python312_alpine
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/argo-python3.12.2-alpine3.19:latest,ghcr.io/rackerlabs/understack/argo-python3.12.2-alpine3.19:${{ env.VERSION_PYTHON312 }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_PYTHON312 }}
- name: Build and deploy Python 3.11 with Ironic client
uses: docker/build-push-action@v5
with:
context: argo-workflows/nautobot-to-ironic-device-sync
file: argo-workflows/nautobot-to-ironic-device-sync/containers/Dockerfile.ironic
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/argo-ironic-client-python3.11.8:latest,ghcr.io/rackerlabs/understack/argo-ironic-client-python3.11.8:${{ env.VERSION_PYTHON_IRONIC }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_PYTHON_IRONIC }}
- name: Build and deploy Argo Utils image
uses: docker/build-push-action@v5
with:
context: argo-workflows/generic/
file: argo-workflows/generic/containers/Dockerfile.argo_utils
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/argo-utils-python3.11.8:latest,ghcr.io/rackerlabs/understack/argo-utils-python3.11.8:${{ env.VERSION_ARGO_UTILS }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_ARGO_UTILS }}
- name: Build and deploy OBM Utils image
uses: docker/build-push-action@v5
with:
context: argo-workflows/obm-utils/
file: argo-workflows/obm-utils/containers/Dockerfile.obm_utils
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/argo-obm-utils-python3.11.8:latest,ghcr.io/rackerlabs/understack/argo-obm-utils-python3.11.8:${{ env.VERSION_OBM_UTILS }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_OBM_UTILS }}
- name: Build and deploy Python 3.11 with Nautobot Int Sync
uses: docker/build-push-action@v5
with:
context: argo-workflows/nautobot-interface-sync
file: argo-workflows/nautobot-interface-sync/containers/Dockerfile.nautobot_int_sync
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/nautobot-interfaces-sync:latest,ghcr.io/rackerlabs/understack/nautobot-interfaces-sync:${{ env.VERSION_PYTHON_NAUTOBOT_INT_SYNC }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_PYTHON_NAUTOBOT_INT_SYNC }}
- name: Build and deploy Python 3.11 with PyNautobot
uses: docker/build-push-action@v5
with:
context: argo-workflows/nautobot-interface-sync
file: argo-workflows/ironic-to-nautobot-sync/containers/Dockerfile
# push for all main branch commits
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/rackerlabs/understack/ironic-to-nautobot-sync:latest,ghcr.io/rackerlabs/understack/ironic-to-nautobot-sync:${{ env.VERSION_PYTHON_NAUTOBOT }}
labels: |
org.opencontainers.image.version=${{ env.VERSION_PYTHON_NAUTOBOT_INT_SYNC }}