Skip to content

DEV: Introduce arm64 dev image and multi-arch manifests #1955

DEV: Introduce arm64 dev image and multi-arch manifests

DEV: Introduce arm64 dev image and multi-arch manifests #1955

Workflow file for this run

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:
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) }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set arch helper output
id: arch-helper
run: |
echo "arch_postfix_dash=${{ (matrix.arch == 'arm64' && '-arm64') || '' }}" >> $GITHUB_OUTPUT
echo "arch_postfix_underscore=${{ (matrix.arch == 'arm64' && '_arm64') || '' }}" >> $GITHUB_OUTPUT
- name: build slim image
run: |
cd image && ruby auto_build.rb base_slim${{ steps.arch-helper.outputs.arch_postfix_underscore }}
- name: tag slim images
id: tag-images
run: |
TAG=`date +%Y%m%d-%H%M`
echo "tag=$(echo $TAG)" >> $GITHUB_OUTPUT
docker tag discourse/base:build_slim${{ steps.arch-helper.outputs.arch_postfix_underscore }} discourse/base:2.0.$TAG-slim${{ steps.arch-helper.outputs.arch_postfix_dash }}
docker tag discourse/base:build_slim${{ steps.arch-helper.outputs.arch_postfix_underscore }} discourse/base:slim${{ steps.arch-helper.outputs.arch_postfix_dash }}
- name: build release image
run: |
cd image && ruby auto_build.rb base${{ steps.arch-helper.outputs.arch_postfix_underscore }}
- name: tag amd64 release images
run: |
TAG=${{ steps.tag-images.outputs.tag }}
docker tag discourse/base:build${{ steps.arch-helper.outputs.arch_postfix_underscore }} discourse/base:2.0.$TAG${{ steps.arch-helper.outputs.arch_postfix_dash }}
docker tag discourse/base:build${{ steps.arch-helper.outputs.arch_postfix_underscore }} discourse/base:release${{ steps.arch-helper.outputs.arch_postfix_dash }}
- name: build test_build image
run: |
cd image && ruby auto_build.rb discourse_test_build${{ steps.arch-helper.outputs.arch_postfix_underscore }}
- name: run specs
run: |
docker run --rm -e RUBY_ONLY=1 -e USE_TURBO=1 -e SKIP_PLUGINS=1 -e SKIP_LINT=1 discourse/discourse_test:build${{ steps.arch-helper.outputs.arch_postfix_underscore }}
- name: Print summary
run: |
docker images discourse/base
- name: push to dockerhub
if: success() && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
TAG=${{ steps.tag-images.outputs.tag }}
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/base:2.0.$TAG-slim${{ steps.arch-helper.outputs.arch_postfix_dash }}
docker push discourse/base:slim${{ steps.arch-helper.outputs.arch_postfix_dash }}
docker push discourse/base:2.0.$TAG${{ steps.arch-helper.outputs.arch_postfix_dash }}
docker push discourse/base:release${{ steps.arch-helper.outputs.arch_postfix_dash }}
- name: Push discourse/base:aarch64 image for backwards compatibility
if: success() && (github.ref == 'refs/heads/main') && (matrix.arch == 'arm64')
run: |
docker tag discourse/base:release${{ steps.arch-helper.outputs.arch_postfix_dash }} 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
dev:
# `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: 30
needs: timestamp

Check failure on line 131 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 131, Col: 12): Job 'dev' depends on unknown job 'timestamp'. .github/workflows/build.yml (Line: 153, Col: 13): Job 'stamp_dev' depends on job 'dev' which creates a cycle in the dependency graph.
env:
TIMESTAMP: ${{ needs.timestamp.outputs.timestamp }}
steps:
# - *install_docker
# - *install_ruby
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: build discourse_dev image
run: |
cd image && ruby auto_build.rb discourse_dev${{ matrix.arch == 'arm64' && '_arm64' || ''}}
- name: push to dockerhub
if: success() # && (github.ref == 'refs/heads/main')
env:
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: |
docker tag discourse/discourse_dev:build discourse/discourse_dev:${{matrix.arch}}-$TIMESTAMP
docker login --username discoursebuild --password $DOCKERHUB_PASSWORD
docker push discourse/discourse_dev:${{ matrix.arch }}-$TIMESTAMP
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