DEV: Introduce arm64 dev image and multi-arch manifests #1957
Workflow file for this run
This file contains hidden or 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
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
concurrency: | |
group: build-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }} | |
cancel-in-progress: true | |
env: | |
BUILDKIT_PROGRESS: plain | |
jobs: | |
timestamp: | |
runs-on: ubuntu-latest | |
outputs: | |
timestamp: ${{ steps.timestamp.outputs.timestamp }} | |
steps: | |
- id: timestamp | |
run: | | |
timestamp=`date +%Y%m%d-%H%M` | |
echo "timestamp=$timestamp" | |
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT | |
base: | |
# `unbuntu-20.04-8core` for arch amd64 non-scheduled builds | |
# `unbuntu-20.04` for arch amd64 scheduled builds | |
# `unbuntu-20.04-8core-arm` for arch arm64 non-scheduled builds | |
# `unbuntu-20.04-2core-arm` for arch arm64 scheduled builds | |
runs-on: ubuntu-20.04${{ ((github.event_name != 'schedule') && '-8core') || (( matrix.arch == 'arm64' && '-2core' ) || '') }}${{ (matrix.arch == 'arm64') && '-arm' || '' }} | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
timeout-minutes: ${{ (github.event_name != 'schedule' && 30) || ((matrix.arch == 'arm64' && 60) || 30) }} | |
needs: timestamp | |
env: | |
ARCH: ${{matrix.arch}} | |
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: build & tag slim image | |
run: | | |
cd image && ruby auto_build.rb base_slim_$ARCH | |
docker tag discourse/base:build_slim_$ARCH discourse/base:2.0.$TIMESTAMP-slim-$ARCH | |
docker tag discourse/base:build_slim_$ARCH discourse/base:slim-$ARCH | |
- name: build & tag release image | |
run: | | |
cd image && ruby auto_build.rb base_$ARCH | |
docker tag discourse/base:build_$ARCH discourse/base:2.0.$TIMESTAMP-$ARCH | |
docker tag discourse/base:build_$ARCH discourse/base:release-$ARCH | |
- name: build test_build image | |
run: | | |
cd image && ruby auto_build.rb discourse_test_build_$ARCH | |
- name: run specs using test_build image | |
run: | | |
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build_$ARCH | |
- name: build & tag dev image | |
run: | | |
cd image && ruby auto_build.rb discourse_dev_build_$ARCH | |
docker tag discourse/discourse_dev:build_$ARCH discourse/discourse_dev:$TIMESTAMP-$ARCH | |
- name: Print summary | |
run: | | |
docker images discourse/base | |
- name: push to dockerhub | |
if: github.ref == 'refs/heads/main' | |
env: | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD | |
docker push discourse/base:2.0.$TIMESTAMP-slim-$ARCH | |
# docker push discourse/base:slim-$ARCH | |
docker push discourse/base:2.0.$TIMESTAMP-$ARCH | |
# docker push discourse/base:release-$ARCH | |
docker push discourse/discourse_dev:$TIMESTAMP-$ARCH | |
- name: Push discourse/base:aarch64 image for backwards compatibility | |
if: (github.ref == 'refs/heads/main') && (matrix.arch == 'arm64') | |
run: | | |
docker tag discourse/base:release-$ARCH discourse/base:aarch64 | |
docker push discourse/base:aarch64 | |
test: | |
runs-on: ubuntu-20.04${{ ((github.event_name != 'schedule') && '-8core') || '' }} | |
timeout-minutes: 30 | |
needs: base | |
defaults: | |
run: | |
working-directory: image/discourse_test | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: build discourse_test:slim | |
run: | | |
docker buildx build . --load \ | |
--build-arg from_tag=slim \ | |
--target base \ | |
--tag discourse/discourse_test:slim | |
- name: build discourse_test:slim-browsers | |
run: | | |
docker buildx build . --load \ | |
--build-arg from_tag=slim \ | |
--target with_browsers \ | |
--tag discourse/discourse_test:slim-browsers | |
- name: build discourse_test:release | |
run: | | |
docker buildx build . --load \ | |
--build-arg from_tag=release \ | |
--target release \ | |
--tag discourse/discourse_test:release | |
- name: Print summary | |
run: | | |
docker images discourse/discourse_test | |
- name: push to dockerhub | |
if: success() && (github.ref == 'refs/heads/main') | |
env: | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
run: | | |
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD | |
docker push discourse/discourse_test:slim | |
docker push discourse/discourse_test:slim-browsers | |
docker push discourse/discourse_test:release | |
# stamp_dev: | |
# runs-on: ubuntu-latest | |
# needs: [dev, timestamp] | |
# env: | |
# TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }} | |
# # if: github.ref == 'refs/heads/main' | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 1 | |
# - name: stamp discourse_dev image | |
# run: | | |
# docker login --username discoursebuild --password ${{ secrets.DOCKERHUB_PASSWORD }} | |
# docker manifest create discourse/discourse_dev:release-$TIMESTAMP \ | |
# -a discourse/discourse_dev:amd64-$TIMESTAMP \ | |
# -a discourse/discourse_dev:arm64-$TIMESTAMP | |
# docker manifest push discourse/discourse_dev:release-$TIMESTAMP |