Enable multi-arch builds

This commit is contained in:
sethforprivacy
2022-08-10 13:47:09 -04:00
parent 2e63bd433e
commit 65211c0c7a
2 changed files with 34 additions and 13 deletions

View File

@@ -3,11 +3,22 @@ on:
schedule: schedule:
- cron: "0 12 * * 1" # Run every Monday at noon. - cron: "0 12 * * 1" # Run every Monday at noon.
workflow_dispatch: workflow_dispatch:
jobs: jobs:
rebuild-container: rebuild-container:
name: "Rebuild Container with the latest base image" name: "Rebuild Container with the latest base image"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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@v2.0.0
with:
platforms: linux/arm64
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0 uses: docker/setup-buildx-action@v2.0.0
@@ -31,11 +42,12 @@ jobs:
id: get_tag id: get_tag
run: echo "::set-output name=tag::$(awk -F "=" '/P2POOL_BRANCH=/ {print $2}' Dockerfile)" run: echo "::set-output name=tag::$(awk -F "=" '/P2POOL_BRANCH=/ {print $2}' Dockerfile)"
- -
name: Build and push to Docker Hub and Github Packages Docker Registry name: Build and push to Docker Hub and GitHub Packages Docker Registry
id: docker_build id: docker_build
uses: docker/build-push-action@v3.1.1 uses: docker/build-push-action@v3.1.1
with: with:
push: true push: true
platforms: linux/amd64,linux/arm64
tags: | tags: |
ghcr.io/${{ github.repository_owner }}/p2pool:latest ghcr.io/${{ github.repository_owner }}/p2pool:latest
ghcr.io/${{ github.repository_owner }}/p2pool:${{ steps.get_tag.outputs.tag }} ghcr.io/${{ github.repository_owner }}/p2pool:${{ steps.get_tag.outputs.tag }}
@@ -45,6 +57,3 @@ jobs:
org.opencontainers.image.source=${{ github.event.repository.html_url }} org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }} org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.revision=${{ github.sha }}
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

View File

@@ -2,6 +2,8 @@ name: "Update image and push to Github Packages and Docker Hub when Dockerfile i
# Run this workflow every time a new commit pushed to your repository # Run this workflow every time a new commit pushed to your repository
on: on:
push: push:
branches:
- main
paths: paths:
- 'Dockerfile' - 'Dockerfile'
jobs: jobs:
@@ -9,6 +11,16 @@ jobs:
name: "Rebuild Container with the latest base image" name: "Rebuild Container with the latest base image"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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@v2.0.0
with:
platforms: linux/arm64
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.0.0 uses: docker/setup-buildx-action@v2.0.0
@@ -32,11 +44,12 @@ jobs:
id: get_tag id: get_tag
run: echo "::set-output name=tag::$(awk -F "=" '/P2POOL_BRANCH=/ {print $2}' Dockerfile)" run: echo "::set-output name=tag::$(awk -F "=" '/P2POOL_BRANCH=/ {print $2}' Dockerfile)"
- -
name: Build and push to Docker Hub and Github Packages Docker Registry name: Build and push to Docker Hub and GitHub Packages Docker Registry
id: docker_build
uses: docker/build-push-action@v3.1.1 uses: docker/build-push-action@v3.1.1
id: docker_build_push
with: with:
push: true push: true
platforms: linux/amd64,linux/arm64
tags: | tags: |
ghcr.io/${{ github.repository_owner }}/p2pool:latest ghcr.io/${{ github.repository_owner }}/p2pool:latest
ghcr.io/${{ github.repository_owner }}/p2pool:${{ steps.get_tag.outputs.tag }} ghcr.io/${{ github.repository_owner }}/p2pool:${{ steps.get_tag.outputs.tag }}
@@ -46,6 +59,5 @@ jobs:
org.opencontainers.image.source=${{ github.event.repository.html_url }} org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }} org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.revision=${{ github.sha }}
- cache-from: type=registry,ref=${{ secrets.DOCKER_USERNAME }}/simple-monerod:latest
name: Image digest cache-to: type=inline
run: echo ${{ steps.docker_build.outputs.digest }}