Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #37 from ddelange/multi-arch
Browse files Browse the repository at this point in the history
Add multi-arch support to build.sh
  • Loading branch information
stevearc authored Jul 20, 2022
2 parents d90b61b + 23ba891 commit caf6f67
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on:
release:
types: [released, prereleased]
workflow_dispatch: # allow manually running from the Actions tab

jobs:
build:
runs-on: ubuntu-latest
env:
BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
steps:
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- run: bash build.sh --publish
16 changes: 9 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ set -e -o pipefail

./cp-static.sh
tag=$(git describe --tags)
echo "Building $tag"
platforms=${BUILDX_PLATFORMS:-linux/amd64}
alias buildx_build="docker buildx build --platform=${platforms}"
echo "Building ${tag} for platforms ${platforms}"

docker build --pull py3-baseimage -t "stevearc/pypicloud:latest" -t "stevearc/pypicloud:$tag"
docker build --pull py3-alpine -t "stevearc/pypicloud:latest-alpine" -t "stevearc/pypicloud:$tag-alpine"
buildx_build --pull py3-baseimage -t "stevearc/pypicloud:latest"
buildx_build --pull py3-alpine -t "stevearc/pypicloud:latest-alpine"

if [ "$1" == '--publish' ]; then
if [ -n "$(git status --porcelain)" ]; then
Expand All @@ -19,11 +21,11 @@ if [ "$1" == '--publish' ]; then
./test.sh latest
./test.sh latest-alpine
echo "Tests passed"
docker push "stevearc/pypicloud:latest"
docker push "stevearc/pypicloud:latest-alpine"
buildx_build --push py3-baseimage -t "stevearc/pypicloud:latest"
buildx_build --push py3-alpine -t "stevearc/pypicloud:latest-alpine"
if git describe --tags --exact-match; then
docker push "stevearc/pypicloud:$tag"
docker push "stevearc/pypicloud:$tag-alpine"
buildx_build --push py3-baseimage -t "stevearc/pypicloud:$tag"
buildx_build --push py3-alpine -t "stevearc/pypicloud:$tag-alpine"
else
echo "Not pushing $tag because it is not an exact version"
fi
Expand Down

0 comments on commit caf6f67

Please sign in to comment.