Skip to content

Commit cfe0ddc

Browse files
authored
wip
builds a multi-arch image and closes #11127
1 parent 61cd9f0 commit cfe0ddc

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

.github/workflows/ci.yaml

+46-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ jobs:
655655
# to main branch. We are only building this for amd64 platform. (>95% pulls
656656
# are for amd64)
657657
needs: changes
658-
if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false'
658+
if: needs.changes.outputs.docs-only == 'false'
659659
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
660660
env:
661661
DOCKER_CLI_EXPERIMENTAL: "enabled"
@@ -692,12 +692,57 @@ jobs:
692692
go mod download
693693
694694
version="$(./scripts/version.sh)"
695+
tag="main-$(echo "$version" | sed 's/+/-/g')"
696+
echo "tag=$tag" >> $GITHUB_OUTPUT
697+
695698
make gen/mark-fresh
696699
make -j \
697700
build/coder_linux_amd64 \
698701
build/coder_"$version"_windows_amd64.zip \
699702
build/coder_"$version"_linux_amd64.{tar.gz,deb}
700703
704+
- name: Install depot.dev CLI
705+
uses: depot/setup-action@v1
706+
707+
- name: Create an empty base-build-context directory
708+
run: mkdir base-build-context
709+
710+
- name: Determine base image tag
711+
id: image-base-tag
712+
run: |
713+
set -euo pipefail
714+
version="$(./scripts/version.sh)"
715+
echo "base_tag=$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")" >> $GITHUB_OUTPUT
716+
717+
# This uses OIDC authentication, so no auth variables are required.
718+
- name: Build base Docker image via depot.dev
719+
uses: depot/build-push-action@v1
720+
with:
721+
project: wl5hnrrkns
722+
context: base-build-context
723+
file: scripts/Dockerfile.base
724+
platforms: linux/amd64,linux/arm64,linux/arm/v7
725+
tags: ${{ steps.image-base-tag.outputs.base_tag }}
726+
727+
- name: Build Linux Docker images
728+
run: |
729+
set -euxo pipefail
730+
731+
# build Docker images for each architecture
732+
version="$(./scripts/version.sh)"
733+
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
734+
735+
# build and push multi-arch manifest, this depends on the other images
736+
# being pushed so will automatically push them.
737+
738+
make -j push/build/coder_"$version"_linux.tag
739+
./scripts/build_docker_multiarch.sh \
740+
--push \
741+
--target "$(./scripts/image_tag.sh --version latest)" \
742+
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
743+
env:
744+
CODER_BASE_IMAGE_TAG: ${{ steps.image-base-tag.outputs.base_tag }}
745+
701746
- name: Build and Push Linux amd64 Docker Image
702747
id: build-docker
703748
run: |

0 commit comments

Comments
 (0)