File tree 4 files changed +17
-50
lines changed
4 files changed +17
-50
lines changed Original file line number Diff line number Diff line change 11
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
- ARG BASEIMAGE=gcr.io/distroless/static:nonroot-amd64
15
- FROM $BASEIMAGE
14
+ FROM --platform=$BUILDPLATFORM golang:1.23 as builder
15
+
16
+ WORKDIR /workspace
17
+
18
+ COPY . .
19
+
20
+ ARG GOARCH
21
+ ARG LDFLAGS_FLAG
22
+ ARG TAGS_FLAG
23
+
24
+ RUN CGO_ENABLED=0 GOOS=linux go build -o cluster-autoscaler-$GOARCH $LDFLAGS_FLAG $TAGS_FLAG
25
+ FROM gcr.io/distroless/static:nonroot
26
+ ARG GOARCH
27
+ COPY --from=builder /workspace/cluster-autoscaler-$GOARCH /cluster-autoscaler
16
28
17
- COPY cluster-autoscaler-amd64 /cluster-autoscaler
18
29
WORKDIR /
19
30
CMD ["/cluster-autoscaler" ]
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 20
20
FOR_PROVIDER =
21
21
endif
22
22
ifdef LDFLAGS
23
- LDFLAGS_FLAG =--ldflags "${LDFLAGS}"
23
+ LDFLAGS_FLAG=--ldflags = "${LDFLAGS}"
24
24
else
25
25
LDFLAGS_FLAG =
26
26
endif
@@ -64,15 +64,9 @@ dev-release-arch-%: build-arch-% make-image-arch-% push-image-arch-%
64
64
make-image : make-image-arch-$(GOARCH )
65
65
66
66
make-image-arch-% :
67
- ifdef BASEIMAGE
68
- docker build --pull --build-arg BASEIMAGE=${BASEIMAGE} \
67
+ GOOS=$(GOOS ) GOARCH=$* docker buildx build --pull --platform linux/$* \
69
68
-t ${IMAGE} -$* :${TAG} \
70
- -f Dockerfile.$* .
71
- else
72
- docker build --pull \
73
- -t ${IMAGE}-$*:${TAG} \
74
- -f Dockerfile.$* .
75
- endif
69
+ -f Dockerfile .
76
70
@echo " Image ${TAG}${FOR_PROVIDER} -$* completed"
77
71
78
72
push-image : push-image-arch-$(GOARCH )
You can’t perform that action at this time.
0 commit comments