Skip to content

Build and Push Ubuntu Images #31

Build and Push Ubuntu Images

Build and Push Ubuntu Images #31

Workflow file for this run

name: Build and Push Ubuntu Images
on:
push:
branches-ignore:
- none
paths:
- "ubuntu/**"
- "ubuntu_dev/**"
workflow_dispatch:
jobs:
build:
name: Build
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
config:
- { dockerfile: "ubuntu/Dockerfile", context: "ubuntu", image_name: "ubuntu", tag_name: "latest" }
- { dockerfile: "ubuntu/Dockerfile.rolling", context: "ubuntu", image_name: "ubuntu", tag_name: "rolling" }
- { dockerfile: "ubuntu/Dockerfile.xenial", context: "ubuntu", image_name: "ubuntu", tag_name: "xenial" }
- { dockerfile: "ubuntu/Dockerfile.bionic", context: "ubuntu", image_name: "ubuntu", tag_name: "bionic" }
- { dockerfile: "ubuntu/Dockerfile.focal", context: "ubuntu", image_name: "ubuntu", tag_name: "focal" }
- { dockerfile: "ubuntu/Dockerfile.jammy", context: "ubuntu", image_name: "ubuntu", tag_name: "jammy" }
- { dockerfile: "ubuntu/Dockerfile.noble", context: "ubuntu", image_name: "ubuntu", tag_name: "noble" }
- { dockerfile: "ubuntu_dev/Dockerfile", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "latest" }
- { dockerfile: "ubuntu_dev/Dockerfile.rolling", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "rolling" }
- { dockerfile: "ubuntu_dev/Dockerfile.xenial", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "xenial" }
- { dockerfile: "ubuntu_dev/Dockerfile.bionic", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "bionic" }
- { dockerfile: "ubuntu_dev/Dockerfile.focal", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "focal" }
- { dockerfile: "ubuntu_dev/Dockerfile.jammy", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "jammy" }
- { dockerfile: "ubuntu_dev/Dockerfile.noble", context: "ubuntu_dev", image_name: "ubuntu_dev", tag_name: "noble" }
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set tag name based on branch
id: set_tag
run: |
if [[ "${{ github.ref_name }}" == "master" ]]; then
echo "tag=${{ matrix.config.tag_name }}" >> $GITHUB_OUTPUT
else
GITHUB_REFNAME=${{ github.ref_name }}
BRANCH_NAME=${GITHUB_REFNAME//\//_}
echo "tag=${{ matrix.config.tag_name }}-$BRANCH_NAME" >> $GITHUB_OUTPUT
fi
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.config.context }}
file: ${{ matrix.config.dockerfile }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: hivesolutions/${{ matrix.config.image_name }}:${{ steps.set_tag.outputs.tag }}