Skip to content

v3.4.0 (multi-arch)

v3.4.0 (multi-arch) #6

Workflow file for this run

#
# Builds and tests a multi-arch (amd64/arm64) image
#
name: build-stanford
on:
release:
types: [published]
jobs:
deploy-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
registry: ghcr.io
username: susom
repository: geocoder
steps:
- name: Checkout
uses: actions/checkout@v2
- name: create latest tag variable
run: |
container="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:latest"
echo "container=${container}" >> $GITHUB_ENV
- name: create release tag variable
if: github.event_name == 'release'
run: |
versioned="${{ env.registry }}/${{ env.username}}/${{ env.repository }}:${GITHUB_REF##*/}"
echo "versioned=${versioned}" >> $GITHUB_ENV
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build AMD64 image
id: build-amd64
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
tags: ${{ env.container }}
- name: Test AMD64 image
id: test-amd64
run: |
docker run --platform linux/amd64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv
docker run --platform linux/amd64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv 0.6
docker run --platform linux/amd64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv all
- name: Build ARM64 image
id: build-arm64
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
tags: ${{ env.container }}
- name: Test ARM64 image
id: test-arm64
run: |
docker run --platform linux/arm64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv
docker run --platform linux/arm64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv 0.6
docker run --platform linux/arm64 --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file.csv all
- name: Login to ghcr
uses: docker/login-action@v1
with:
registry: ${{ env.registry }}
username: ${{ env.username }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push multi-arch image
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: |
${{ env.container }}
${{ env.versioned }}