Skip to content

ci: use Docker Build Cloud #87

ci: use Docker Build Cloud

ci: use Docker Build Cloud #87

Workflow file for this run

name: "Build"
on:
push:
branches:
- "**"
tags:
- "**"
jobs:
docker-image:
name: "Docker image"
runs-on: ubuntu-latest
steps:
- name: "Define the Docker image version"
id: image_version
run: |
if [[ "${GITHUB_REF}" =~ 'refs/tags/' ]]
then
echo DEFAULT_IMAGE_VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_OUTPUT
echo ALPINE_IMAGE_VERSION=${GITHUB_REF#refs/tags/}-alpine >> $GITHUB_OUTPUT
else
echo DEFAULT_IMAGE_VERSION=latest >> $GITHUB_OUTPUT
echo ALPINE_IMAGE_VERSION=alpine >> $GITHUB_OUTPUT
fi
if [[ "${{ github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') }}" == true ]]
then
BUILD_OUTPUT="registry"
else
BUILD_OUTPUT="cacheonly"
fi
echo BUILD_OUTPUT=${BUILD_OUTPUT} >> $GITHUB_OUTPUT
- name: "Checkout"
uses: actions/checkout@v4
- name: "Login to DockerHub"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "xstefanox/remote-arm"
- name: "Build and push / default"
uses: docker/build-push-action@v6
with:
tags: xstefanox/swarmcret:${{ steps.image_version.outputs.DEFAULT_IMAGE_VERSION }}
platforms: linux/amd64,linux/arm64
target: default
outputs: type=${{ steps.image_version.outputs.BUILD_OUTPUT }}
- name: "Build and push / Alpine"
uses: docker/build-push-action@v6
with:
tags: xstefanox/swarmcret:${{ steps.image_version.outputs.ALPINE_IMAGE_VERSION }}
platforms: linux/amd64,linux/arm64
target: alpine
outputs: type=${{ steps.image_version.outputs.BUILD_OUTPUT }}