Skip to content

Commit

Permalink
Add multi-arch docker-build
Browse files Browse the repository at this point in the history
This commit adds multi-arch docker builds using docker buildx
to the release script and a new github action.
  • Loading branch information
rhnvrm committed Nov 6, 2020
1 parent f1c355b commit c2aca9d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-and-push-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: docker
on:
push:
tags:
- '*'
jobs:
multi:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/beehive
tag-sha: false
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
13 changes: 13 additions & 0 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ fi

echo "Releasing ${TAG} ..."

# Tag git and push
git tag -a -s -m "Release ${TAG}" "${TAG}"
git push --tags

# Run goreleaser
goreleaser release --rm-dist

# Build and push Docker image
DOCKER_REPO="fribbledom/beehive"
docker buildx build \
--progress plain \
--platform=linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6 \
-t="$DOCKER_REPO:$TAG" \
-t="$DOCKER_REPO:latest" \
--push \
.

0 comments on commit c2aca9d

Please sign in to comment.