Skip to content

add per arch Dockerfiles #3

add per arch Dockerfiles

add per arch Dockerfiles #3

Workflow file for this run

name: Build and publish container
on:
push:
branches: [master, main]
workflow_dispatch:
inputs:
reason:
description: "Why ?"
required: false
default: ""
jobs:
ghr:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Log-in to ghcr.io
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push container image
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# when the branch is master, replace master with latest
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
# Build and Publish container image
docker buildx build --push \
--tag $IMAGE_ID:$VERSION \
--platform linux/amd64,linux/arm64,linux/armv7hf ./hostsetter
balena_cloud_build:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: [aarch64, amd64, armv7hf]
steps:
- uses: actions/checkout@v3
- uses: balena-io/deploy-to-balena-action@master
id: build
with:
balena_token: ${{ secrets.BALENA_TOKEN }}
fleet: arribada/hostsetter-${{ matrix.arch }}
create_tag: true
- name: Log release ID built
run: echo "Built release ID ${{ steps.build.outputs.release_id }}"