Improve Dockerfile and add Github Actions builds #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test build of image when Dockerfile is changed" | |
on: | |
push: | |
paths: | |
- 'Dockerfile' | |
branches-ignore: | |
- master | |
pull_request: | |
paths: | |
- 'Dockerfile' | |
workflow_dispatch: | |
jobs: | |
rebuild-container: | |
name: "Build image with cache" | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up QEMU | |
uses: docker/[email protected] | |
with: | |
platforms: linux/arm64 | |
- | |
name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- | |
name: Checkout repository | |
uses: actions/checkout@v4 | |
- | |
name: Build x86_64 image | |
id: docker_build_amd64 | |
uses: docker/[email protected] | |
with: | |
push: false | |
load: true | |
platforms: linux/amd64 | |
tags: utreexod:amd64 | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest | |
- | |
name: Test-run x86_64 image | |
run: | | |
docker run --rm utreexod:amd64 & | |
PID=$! | |
sleep 5 | |
kill -SIGINT $PID # this will return a non-zero exit code if the container dies early on | |
- | |
name: Build ARMv8 image | |
id: docker_build_arm64 | |
uses: docker/[email protected] | |
with: | |
push: false | |
load: true | |
platforms: linux/arm64 | |
tags: utreexod:arm64 | |
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest |