Add support for multi-arch docker images #974
Workflow file for this run
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
# Any PR opened, build images and run tests | |
name: Test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
DOCKER_ORG: pangeo | |
GITHUB_SHA: ${{ github.sha }} | |
GITHUB_REF: ${{ github.ref }} | |
jobs: | |
matrix-build: | |
strategy: | |
fail-fast: false | |
matrix: | |
IMAGE: [base-notebook, pangeo-notebook, ml-notebook, pytorch-notebook] | |
name: ${{ matrix.IMAGE }} | |
runs-on: ubuntu-latest | |
services: | |
# https://github.com/docker/build-push-action/blob/master/docs/advanced/local-registry.md#local-registry | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
- name: Free up disk space | |
run: | | |
df -h | |
docker image ls | |
sudo apt clean | |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc | |
df -h | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: network=host | |
- name: Build base-image | |
uses: docker/build-push-action@v5 | |
with: | |
context: base-image | |
platforms: linux/amd64,linux/arm64 | |
tags: localhost:5000/pangeo/base-image:PR | |
push: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build Only | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.IMAGE }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: localhost:5000/${{env.DOCKER_ORG}}/${{ matrix.IMAGE }}:PR | |
build-args: PANGEO_BASE_IMAGE_TAG=PR | |
build-contexts: | | |
pangeo/base-image:PR=docker-image://localhost:5000/pangeo/base-image:PR | |
- name: List Conda Packages | |
run: | | |
docker run localhost:5000/${DOCKER_ORG}/${{ matrix.IMAGE }}:PR conda list --export | |
- name: Report Image Size | |
run: | | |
docker image ls | |
- name: Test Image | |
run: | | |
docker run -u 1000 -w /srv/test -v $PWD:/srv/test localhost:5000/${DOCKER_ORG}/${{ matrix.IMAGE }}:PR ./run_tests.sh ${{ matrix.IMAGE }} |