Skip to content

Commit

Permalink
ci: cluster-autoscaler multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-sakhnov committed Oct 29, 2024
1 parent fdb487d commit c3fc163
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,19 +314,20 @@ jobs:
build-args: |
GO_BASE_IMG=${{ env.GO_BASE_IMG }}
GIT_INFO=${{ steps.get-git-info.outputs.info }}
# TODO: AUTOSCALER IMAGE IS HARDCODED FOR AMD
# - name: Build and push cluster-autoscaler image
# uses: docker/build-push-action@v6
# if: ${{ format('{0}', inputs.build-cluster-autoscaler) == 'true' }}
# with:
# context: cluster-autoscaler

# push: true
# tags: ${{ needs.tags.outputs.cluster-autoscaler }}
# cache-from: type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache
# cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache,mode=max' || '' }}
# build-args: |
# CA_GIT_TAG=${{ steps.get-ca-tag.outputs.tag }}
- name: Build and push cluster-autoscaler image
uses: docker/build-push-action@v6
if: ${{ format('{0}', inputs.build-cluster-autoscaler) == 'true' }}
with:
context: cluster-autoscaler
platforms: linux/${{ matrix.arch }}
push: true
target: ${{format('cluster_autoscaler_{0}', matrix.arch)}}
tags: ${{ needs.tags.outputs.cluster-autoscaler }}
cache-from: type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache
cache-to: ${{ github.ref_name == 'main' && 'type=registry,ref=cache.neon.build/cluster-autoscaler-neonvm:cache,mode=max' || '' }}
build-args: |
CA_GIT_TAG=${{ steps.get-ca-tag.outputs.tag }}
# - name: Copy all images to ECR
# if: ${{ format('{0}', inputs.upload-to-ecr) == 'true' }}
Expand Down
10 changes: 9 additions & 1 deletion cluster-autoscaler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ RUN cd autoscaler/cluster-autoscaler \
# This is adapted from CA's Dockerfile.amd64, here:
# https://github.com/kubernetes/autoscaler/blob/cluster-autoscaler-1.24.1/cluster-autoscaler/Dockerfile.amd64

FROM gcr.io/distroless/static:nonroot-amd64

# NB: two build stages, one for each architecture, because I wasn't able to use variable substitution in FROM statements
FROM gcr.io/distroless/static:nonroot-amd64 as cluster_autoscaler_amd64

WORKDIR /
COPY --from=builder /workspace/cluster-autoscaler .
CMD ["/cluster-autoscaler"]

FROM gcr.io/distroless/static:nonroot-arm64 as cluster_autoscaler_arm64

WORKDIR /
COPY --from=builder /workspace/cluster-autoscaler .
Expand Down

0 comments on commit c3fc163

Please sign in to comment.