@@ -656,11 +656,9 @@ jobs:
656
656
# are for amd64)
657
657
needs : changes
658
658
if : github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false'
659
- runs-on : ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
660
- env :
661
- DOCKER_CLI_EXPERIMENTAL : " enabled"
659
+ runs-on : ubuntu-latest
662
660
outputs :
663
- IMAGE : ghcr.io/coder/coder-preview:${{ steps.build-docker .outputs.tag }}
661
+ IMAGE : ghcr.io/coder/coder-preview:${{ steps.build.outputs.tag }}
664
662
steps :
665
663
- name : Checkout
666
664
uses : actions/checkout@v4
@@ -687,38 +685,68 @@ jobs:
687
685
run : sudo apt-get install -y zstd
688
686
689
687
- name : Build
688
+ id : build
690
689
run : |
691
690
set -euxo pipefail
692
691
go mod download
693
692
694
693
version="$(./scripts/version.sh)"
695
694
make gen/mark-fresh
696
695
make -j \
697
- build/coder_linux_amd64 \
696
+ build/coder_linux_{amd64,arm64,armv7} \
698
697
build/coder_"$version"_windows_amd64.zip \
699
698
build/coder_"$version"_linux_amd64.{tar.gz,deb}
700
-
701
- - name : Build and Push Linux amd64 Docker Image
702
- id : build-docker
703
- run : |
704
- set -euxo pipefail
705
- version="$(./scripts/version.sh)"
706
- tag="main-$(echo "$version" | sed 's/+/-/g')"
707
-
708
- export CODER_IMAGE_BUILD_BASE_TAG="$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")"
709
- ./scripts/build_docker.sh \
710
- --arch amd64 \
711
- --target "ghcr.io/coder/coder-preview:$tag" \
712
- --version $version \
713
- --push \
714
- build/coder_linux_amd64
715
-
716
- # Tag as main
717
- docker tag "ghcr.io/coder/coder-preview:$tag" ghcr.io/coder/coder-preview:main
718
- docker push ghcr.io/coder/coder-preview:main
719
-
720
- # Store the tag in an output variable so we can use it in other jobs
699
+
700
+ # create base image tag
701
+ base_tag="coder-base:$version"
702
+
703
+ # replace + with - in tag
704
+ base_tag="${base_tag/+/-}"
705
+
706
+ # create image tag
707
+ tag="main-$version"
708
+
709
+ # replace + with - in tag
710
+ tag="${tag/+/-}"
711
+
712
+ # create an empty build directory
713
+ mkdir -p tmp
714
+
715
+ # export version, base_tag, and tag as outputs
716
+ echo "version=$version" >> $GITHUB_OUTPUT
717
+ echo "base_tag=$base_tag" >> $GITHUB_OUTPUT
721
718
echo "tag=$tag" >> $GITHUB_OUTPUT
719
+
720
+ - name : Set up Depot
721
+ uses : depot/setup-action@v1
722
+
723
+ - name : Build multi arch base image
724
+ uses : depot/build-push-action@v1
725
+ with :
726
+ project : 9rcqzb56rm
727
+ context : ./tmp
728
+ platforms : linux/amd64,linux/arm64,linux/arm/v7
729
+ tags : ${{ steps.build.outputs.base_tag }}
730
+ file : ./scripts/Dockerfile.base
731
+ push : false
732
+ save : true
733
+
734
+ - name : Build and push multi arch image
735
+ uses : depot/build-push-action@v1
736
+ with :
737
+ project : 9rcqzb56rm
738
+ context : ./tmp
739
+ platforms : linux/amd64,linux/arm64,linux/arm/v7
740
+ file : ./scripts/Dockerfile
741
+ push : ${{ github.event_name != 'pull_request' }}
742
+ pull : true
743
+ tags : |
744
+ ghcr.io/coder/coder-preview:${{ steps.build.outputs.tag }}
745
+ ghcr.io/coder/coder-preview:main
746
+ ghcr.io/coder/coder-preview:latest
747
+ build-args : |
748
+ BASE_IMAGE=${{ steps.build.outputs.base_tag }}
749
+ CODER_VERSION=${{ steps.build.outputs.version }}
722
750
723
751
- name : Prune old images
724
752
uses : vlaurin/action-ghcr-prune@v0.5.0
0 commit comments