Skip to content

add arm support

add arm support #90

Workflow file for this run

#
# Copyright (c) 2021-2025 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
name: image-publish
on:
push:
branches:
- main
tags:
- '7.*.*'
jobs:
build:
name: build
strategy:
fail-fast: false
matrix:
dist: [ 'musl', 'libc-ubi8', 'libc-ubi9' ]
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
steps:
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
- name: Docker Build
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker buildx build --memory-swap -1 --memory 10g --platform linux/${{env.arch}} -f build/dockerfiles/linux-${{matrix.dist}}.Dockerfile --load -t linux-${{matrix.dist}}-${{env.arch}} .
- name: Upload image
uses: ishworkh/container-image-artifact-upload@v2.0.0
with:
image: "linux-${{matrix.dist}}-${{env.arch}}"
assemble:
name: assemble
needs: build
strategy:
fail-fast: false
matrix:
runners: ['ubuntu-22.04', 'ubuntu-22.04-arm']
runs-on: ${{matrix.runners}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set branch environment variable
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Set arch environment variable
run: |
if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then
echo arch="amd64" >> $GITHUB_ENV
else
echo arch="arm64" >> $GITHUB_ENV
fi
- name: Set tag suffix environment variable
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{env.BRANCH_NAME}} == main ]]; then
echo "tag_suffix=${SHORT_SHA1}" >> $GITHUB_ENV
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
echo "tag_suffix=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
fi
- name: Download linux-libc-ubi8-amd64 image
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-libc-ubi8-${{env.arch}}"
- name: Download linux-libc-ubi9-amd64 image
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-libc-ubi9-${{env.arch}}"
- name: Download linux-musl image
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "linux-musl-${{env.arch}}"
- name: Display docker images
run: docker images
- name: Update assembly.Dockerfile
run: |
sed "s|FROM linux-libc-ubi8|FROM linux-libc-ubi8-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
sed "s|FROM linux-libc-ubi9|FROM linux-libc-ubi9-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
sed "s|FROM linux-musl|FROM linux-musl-${{env.arch}}|" -i "build/dockerfiles/assembly.Dockerfile"
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Assemble che-code
run: |
docker buildx build \
--platform linux/${{env.arch}} \
--progress=plain \
--push \
-f build/dockerfiles/assembly.Dockerfile \
-t quay.io/che-incubator/che-code:${{env.arch}}-${{env.tag_suffix}} .
publish:
name: publish
needs: assemble
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set branch environment variable
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
- name: Set tag suffix environment variable
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{env.BRANCH_NAME}} == main ]]; then
echo "tag_suffix=${SHORT_SHA1}" >> $GITHUB_ENV
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
echo "tag_suffix=${{ env.BRANCH_NAME }}" >> $GITHUB_ENV
fi
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: publish
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
if [[ ${{env.BRANCH_NAME}} == main ]]; then
docker manifest create quay.io/che-incubator/che-code:next --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:next quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:next
docker manifest create quay.io/che-incubator/che-code:insiders --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:insiders quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:insiders
docker manifest create quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
docker manifest annotate quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:insiders-${SHORT_SHA1} quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:insiders-${SHORT_SHA1}
elif [[ ${{env.BRANCH_NAME}} =~ ^7\.[0-9]+\.[0-9]+$ ]]; then
docker manifest create quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
docker manifest annotate quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }} quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:${{ env.BRANCH_NAME }}
docker manifest create quay.io/che-incubator/che-code:latest --amend quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --amend quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}}
docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:amd64-${{env.tag_suffix}} --os linux --arch amd64
docker manifest annotate quay.io/che-incubator/che-code:latest quay.io/che-incubator/che-code:arm64-${{env.tag_suffix}} --os linux --arch arm64
docker manifest push quay.io/che-incubator/che-code:latest
fi
release-finish:
name: release-finish
needs: [build, assemble, publish]
runs-on: ubuntu-22.04
# don't notify for cancelled builds
if: (success() || failure()) && github.ref != 'refs/heads/main'
steps:
- name: Set variables
run: |
BRANCH_NAME=${{ github.ref }}
echo "BRANCH_NAME=${BRANCH_NAME##*/}" >> $GITHUB_ENV
dev:
name: dev
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker Build and Push
env:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
SHORT_SHA1=$(git rev-parse --short=7 HEAD)
docker buildx build --platform linux/amd64 -f build/dockerfiles/dev.Dockerfile --push -t quay.io/che-incubator/che-code-dev:insiders -t quay.io/che-incubator/che-code-dev:next -t quay.io/che-incubator/che-code-dev:insiders-${SHORT_SHA1} .
docker buildx build --platform linux/amd64 -f build/dockerfiles/assembly.sshd.Dockerfile --push -t quay.io/che-incubator/che-code-sshd:insiders -t quay.io/che-incubator/che-code-sshd:next -t quay.io/che-incubator/che-code-sshd:insiders-${SHORT_SHA1} .