-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6338 from voelzmo/enh/switch-to-multistage-build
Switch to multistage build Dockerfiles for VPA
- Loading branch information
Showing
6 changed files
with
64 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,24 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM --platform=$BUILDPLATFORM golang:1.21.5 as builder | ||
|
||
ENV GOPATH /gopath/ | ||
ENV PATH $GOPATH/bin:$PATH | ||
|
||
COPY . /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
WORKDIR /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
|
||
ARG TARGETOS TARGETARCH | ||
|
||
RUN CGO_ENABLED=0 LD_FLAGS=-s GOARCH=$TARGETARCH GOOS=$TARGETOS go build -C pkg/admission-controller -mod vendor -o admission-controller-$TARGETARCH | ||
|
||
FROM gcr.io/distroless/static:latest | ||
MAINTAINER Tomasz Kulczynski "[email protected]" | ||
ARG ARCH | ||
copy admission-controller-$ARCH /admission-controller | ||
|
||
ARG TARGETARCH | ||
|
||
COPY --from=builder /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/admission-controller/admission-controller-$TARGETARCH /admission-controller | ||
|
||
ENTRYPOINT ["/admission-controller"] | ||
CMD ["--v=4", "--stderrthreshold=info"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,24 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM --platform=$BUILDPLATFORM golang:1.21.5 as builder | ||
|
||
ENV GOPATH /gopath/ | ||
ENV PATH $GOPATH/bin:$PATH | ||
|
||
COPY . /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
WORKDIR /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
|
||
ARG TARGETOS TARGETARCH | ||
|
||
RUN CGO_ENABLED=0 LD_FLAGS=-s GOARCH=$TARGETARCH GOOS=$TARGETOS go build -C pkg/recommender -mod vendor -o recommender-$TARGETARCH | ||
|
||
FROM gcr.io/distroless/static:latest | ||
MAINTAINER Krzysztof Grygiel "[email protected]" | ||
|
||
ARG ARCH | ||
COPY recommender-$ARCH /recommender | ||
ARG TARGETARCH | ||
|
||
COPY --from=builder /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/recommender-$TARGETARCH /recommender | ||
|
||
ENTRYPOINT ["/recommender"] | ||
CMD ["--v=4", "--stderrthreshold=info", "--prometheus-address=http://prometheus.monitoring.svc"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,12 +12,24 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM --platform=$BUILDPLATFORM golang:1.21.5 as builder | ||
|
||
ENV GOPATH /gopath/ | ||
ENV PATH $GOPATH/bin:$PATH | ||
|
||
COPY . /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
WORKDIR /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler | ||
|
||
ARG TARGETOS TARGETARCH | ||
|
||
RUN CGO_ENABLED=0 LD_FLAGS=-s GOARCH=$TARGETARCH GOOS=$TARGETOS go build -C pkg/updater -mod vendor -o updater-$TARGETARCH | ||
|
||
FROM gcr.io/distroless/static:latest | ||
MAINTAINER Marcin Wielgus "[email protected]" | ||
|
||
ARG ARCH | ||
COPY updater-$ARCH /updater | ||
ARG TARGETARCH | ||
|
||
COPY --from=builder /gopath/src/k8s.io/autoscaler/vertical-pod-autoscaler/pkg/updater/updater-$TARGETARCH /updater | ||
|
||
ENTRYPOINT ["/updater"] | ||
CMD ["--v=4", "--stderrthreshold=info"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters