Skip to content

ci: build a multi-arch main image #11668

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

Closed
wants to merge 12 commits into from
Prev Previous commit
Next Next commit
use buildjet
  • Loading branch information
matifali committed Jan 17, 2024
commit 7762e8be58531e97fcef32097ea698446cb21acb
18 changes: 9 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ jobs:
# are for amd64)
needs: changes
if: needs.changes.outputs.docs-only == 'false'
runs-on: ubuntu-latest
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
outputs:
IMAGE: ghcr.io/coder/coder-preview:${{ steps.build.outputs.tag }}
steps:
Expand Down Expand Up @@ -700,27 +700,27 @@ jobs:

# create base image tag
base_tag="coder-base:$version"

# replace + with - in tag
base_tag="${base_tag/+/-}"

# create image tag
tag="main-$version"

# replace + with - in tag
tag="${tag/+/-}"

# create an empty build directory
mkdir -p tmp

# export version, base_tag, and tag as outputs
echo "version=$version" >> $GITHUB_OUTPUT
echo "base_tag=$base_tag" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT

- name: Set up Depot
uses: depot/setup-action@v1

- name: Build multi arch base image
uses: depot/build-push-action@v1
with:
Expand All @@ -731,7 +731,7 @@ jobs:
file: ./scripts/Dockerfile.base
push: false
save: true

- name: Build and push multi arch image
uses: depot/build-push-action@v1
with:
Expand All @@ -747,7 +747,7 @@ jobs:
ghcr.io/coder/coder-preview:latest
build-args: |
BASE_IMAGE=${{ steps.build.outputs.base_tag }}
CODER_VERSION=${{ steps.build.outputs.version }}
CODER_VERSION=${{ steps.build.outputs.version }}

- name: Prune old images
uses: vlaurin/action-ghcr-prune@v0.5.0
Expand Down