-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Dockerfile and add Github Actions builds
- Loading branch information
1 parent
07cbc89
commit 1a08ebd
Showing
5 changed files
with
242 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
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/setup-qemu-action@v3.0.0 | ||
with: | ||
platforms: linux/arm64 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.3.0 | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- | ||
name: Build x86_64 image | ||
id: docker_build_amd64 | ||
uses: docker/build-push-action@v5.3.0 | ||
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/build-push-action@v5.3.0 | ||
with: | ||
push: false | ||
load: true | ||
platforms: linux/arm64 | ||
tags: utreexod:arm64 | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: "Update image and push to Github Packages and Docker Hub weekly" | ||
|
||
on: | ||
schedule: | ||
- cron: "0 12 * * 1" # Run every Monday at noon. | ||
workflow_dispatch: | ||
|
||
jobs: | ||
rebuild-container: | ||
name: "Rebuild Container with the latest base image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Prepare outputs | ||
id: prep | ||
run: | | ||
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3.0.0 | ||
with: | ||
platforms: linux/arm64 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.3.0 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- | ||
name: Build and push to Docker Hub and GitHub Packages Docker Registry | ||
id: docker_build | ||
uses: docker/build-push-action@v5.3.0 | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.html_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: "Update image when Dockerfile is changed" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
rebuild-container: | ||
name: "Rebuild Container with the latest base image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Prepare outputs | ||
id: prep | ||
run: | | ||
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3.0.0 | ||
with: | ||
platforms: linux/arm64 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.3.0 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- | ||
name: Build x86_64 image | ||
id: docker_build_amd64 | ||
uses: docker/build-push-action@v5.3.0 | ||
with: | ||
push: false | ||
load: true | ||
platforms: linux/amd64 | ||
tags: utreexod:amd64 | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
cache-to: type=inline | ||
- | ||
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 and push to Docker Hub and GitHub Packages Docker Registry | ||
uses: docker/build-push-action@v5.3.0 | ||
id: docker_build_push | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.html_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
cache-to: type=inline |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: "Update image when a release is published" | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
rebuild-container: | ||
name: "Rebuild Container with the latest base image" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Prepare outputs | ||
id: prep | ||
run: | | ||
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3.0.0 | ||
with: | ||
platforms: linux/arm64 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3.3.0 | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3.1.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- | ||
name: Build x86_64 image | ||
id: docker_build_amd64 | ||
uses: docker/build-push-action@v5.3.0 | ||
with: | ||
push: false | ||
load: true | ||
platforms: linux/amd64 | ||
tags: utreexod:amd64 | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
cache-to: type=inline | ||
- | ||
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 and push to Docker Hub and GitHub Packages Docker Registry | ||
uses: docker/build-push-action@v5.3.0 | ||
id: docker_build_push | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/utreexod:${{ github.ref_name }} | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.html_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/utreexod:latest | ||
cache-to: type=inline |
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