From 472338b9b8234e08a5b55a15327be1aff15916fd Mon Sep 17 00:00:00 2001 From: David Benque Date: Fri, 30 Jun 2023 13:45:03 +0200 Subject: [PATCH] dockerfile and CI --- .gitlab-ci.yml | 15 +++++++++++++++ vertical-pod-autoscaler/Dockerfile | 27 +++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 vertical-pod-autoscaler/Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000000..88423e900c57 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,15 @@ +include: https://gitlab-templates.ddbuild.io/compute-delivery/v2/compute-delivery.yml + +test: + stage: verify + tags: [ "arch:amd64" ] + image: registry.ddbuild.io/images/mirror/golang:1.20 + script: + - echo "TODO test" + +build-docker-image: + variables: + EXTRA_ARGS: "-f vertical-pod-autoscaler/Dockerfile" + + extends: .build-docker-image + diff --git a/vertical-pod-autoscaler/Dockerfile b/vertical-pod-autoscaler/Dockerfile new file mode 100644 index 000000000000..daf58e1fd31b --- /dev/null +++ b/vertical-pod-autoscaler/Dockerfile @@ -0,0 +1,27 @@ +ARG BASE_IMAGE + +FROM --platform=$BUILDPLATFORM golang:1.19 AS builder +WORKDIR /go/src/k8s.io/autoscaler +COPY . . +ARG TARGETARCH +ENV GO111MODULE "on" +ENV GOARCH=${TARGETARCH} + +WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender +RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-recommender --ldflags "-s" + +WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender-external +RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-recommender-external-metrics --ldflags "-s" + +WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller +RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-admission-controller --ldflags "-s" + +WORKDIR /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/updater +RUN env CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=linux go build -o vpa-updater --ldflags "-s" + +FROM $BASE_IMAGE + +COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/vpa-recommender /usr/local/bin/vpa-recommender +COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender-external/vpa-recommender-external-metrics /usr/local/bin/vpa-recommender-external-metrics +COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/vpa-admission-controller /usr/local/bin/vpa-admission-controller +COPY --from=builder /go/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/updater/vpa-updater /usr/local/bin/vpa-updater