Build docker images for amd64 arm64
MODIFY
.github/workflows/release.yml
.github/workflows/release.yml
@@ -32,3 +32,66 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
+
+ publish-docker:
+ runs-on: ubuntu-20.04
+
+ services:
+ # So that we can test this in PRs/branches
+ local-registry:
+ image: registry:2
+ ports:
+ - 5000:5000
+
+ steps:
+ - name: Should we push this image to a public registry?
+ run: |
+ if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/master') }}" = "true" ]; then
+ # Empty => Docker Hub
+ echo "REGISTRY=" >> $GITHUB_ENV
+ else
+ echo "REGISTRY=localhost:5000/" >> $GITHUB_ENV
+ fi
+
+ # versioneer requires the full git history for non-tags
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ # Setup docker to build for multiple platforms, see:
+ # https://github.com/docker/build-push-action/tree/v2.4.0#usage
+ # https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
+
+ - name: Set up QEMU (for docker buildx)
+ uses: docker/setup-qemu-action@25f0500ff22e406f7191a2a8ba8cda16901ca018
+
+ - name: Set up Docker Buildx (for multi-arch builds)
+ uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609
+ with:
+ # Allows pushing to registry on localhost:5000
+ driver-opts: network=host
+
+ - name: Setup push rights to Docker Hub
+ if: env.REGISTRY != 'localhost:5000/'
+ run: |
+ docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
+
+ # when building jupyter/repo2docker:master
+ # also push jupyter/repo2docker:1.2.3-3.abcd1234 (replace + with -)
+ - name: Get list of repo2docker docker tags
+ run: |
+ VERSION=$(python3 -c 'import versioneer; print(versioneer.get_version().replace("+", "-"))')
+ TAGS="${{ env.REGISTRY }}jupyter/repo2docker:$VERSION"
+ if [ "${{ github.ref }}" == "refs/heads/master" ]; then
+ TAGS="$TAGS,${{ env.REGISTRY }}jupyter/repo2docker:master"
+ fi
+ echo "TAGS=$TAGS"
+ echo "TAGS=$TAGS" >> $GITHUB_ENV
+
+ - name: Build and push repo2docker
+ uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ env.TAGS }}

Build docker images for amd64 arm64