Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actions: Build arm64 Docker image too #21548

Merged
merged 4 commits into from
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
- 'tools/docker/config/*'
- '.github/versions.sh'
- '.github/workflows/build-docker.yml'
pull_request:
paths:
- 'tools/docker/Dockerfile'
- 'tools/docker/bin/run.sh'
- 'tools/docker/config/*'
- '.github/versions.sh'
- '.github/workflows/build-docker.yml'
concurrency:
group: build-docker-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -19,11 +26,19 @@ jobs:
permissions:
packages: write
contents: read
timeout-minutes: 20 # 2021-10-14: Test run took 5 minutes, but there's lots of downloading involved.
timeout-minutes: 60 # 2021-10-26: Build for arm64 is S-L-O-W. Sigh.

steps:
- uses: actions/checkout@v2

- name: Set up qemu
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
Expand All @@ -46,16 +61,25 @@ jobs:
echo "::set-output name=node-version::$NODE_VERSION"
echo "::set-output name=pnpm-version::$PNPM_VERSION"

# We're not git-tagging for the env. Just tag all master builds as latest.
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
echo "::set-output name=tags::type=raw,latest"
echo "::set-output name=images::automattic/jetpack-wordpress-dev%0Aghcr.io/automattic/jetpack-wordpress-dev"
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
echo "::set-output name=tags::type=ref,event=pr"
echo "::set-output name=images::ghcr.io/automattic/jetpack-wordpress-dev"
else
echo "Unknown GITHUB_EVENT_NAME $GITHUB_EVENT_NAME"
exit 1
fi

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
# We're not git-tagging for the env. Just tag all builds as latest.
tags: |
type=raw,latest
images: |
automattic/jetpack-wordpress-dev
ghcr.io/automattic/jetpack-wordpress-dev
flavor: latest=false
tags: ${{ steps.buildargs.outputs.tags }}
images: ${{ steps.buildargs.outputs.images }}
labels: |
org.opencontainers.image.title=Jetpack Development Environment
org.opencontainers.image.description=Unified environment for developing in the Jetpack Monorepo using Docker containers.
Expand All @@ -65,6 +89,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: tools/docker
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down