mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
Points directly to the kubebuilder release artifact URL in GitHub, rather than going through `go.kubebuilder.io`. Its redirection, along with the artifact names between versions, has changed and become unstable. This approach gives us a more clear target for the download and will make it easier to patch in the future when newer versions have different filename conventions.
63 lines
2.1 KiB
Docker
63 lines
2.1 KiB
Docker
ARG GOLANG_VERSION=1.16
|
|
|
|
## Kustomize
|
|
FROM golang:${GOLANG_VERSION}-alpine as kustomize
|
|
|
|
ARG KUSTOMIZE_VERSION=3.8.10
|
|
ENV GOPROXY="https://proxy.golang.org/"
|
|
|
|
RUN apk add --no-cache gcc musl-dev
|
|
RUN mkdir /src && cd /src; \
|
|
go mod init tmp && \
|
|
go get sigs.k8s.io/kustomize/kustomize/v3@v${KUSTOMIZE_VERSION}
|
|
|
|
## Controller-gen
|
|
FROM golang:${GOLANG_VERSION}-alpine as controller-gen
|
|
|
|
ARG CONTROLLER_GEN_VERSION=0.3.0
|
|
ENV GOPROXY="https://proxy.golang.org/"
|
|
|
|
RUN mkdir /src && cd /src; \
|
|
go mod init tmp \
|
|
&& go get sigs.k8s.io/controller-tools/cmd/controller-gen@v${CONTROLLER_GEN_VERSION}
|
|
|
|
## Build
|
|
FROM golang:${GOLANG_VERSION}-alpine as build
|
|
|
|
LABEL maintainer="GitLab Distribution Team" \
|
|
description="Build base image for the GitLab Operator project."
|
|
|
|
ARG KUBEBUILDER_VERSION=2.3.1
|
|
ARG YQ_VERSION=4.7.0
|
|
ARG HELM_VERSION=3.5.2
|
|
|
|
RUN apk add --no-cache podman curl make gcc musl-dev git bash coreutils
|
|
RUN go get -u \
|
|
github.com/onsi/ginkgo/ginkgo \
|
|
golang.org/x/lint/golint
|
|
|
|
# Kubebuilder
|
|
RUN curl --retry 6 -Ls https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${KUBEBUILDER_VERSION}/kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64.tar.gz | tar -xz -C /tmp/ \
|
|
&& mv /tmp/kubebuilder_${KUBEBUILDER_VERSION}_linux_amd64 /usr/local/kubebuilder \
|
|
&& ln -sfv /usr/local/kubebuilder/bin/* /usr/local/bin
|
|
|
|
# Yq
|
|
RUN curl --retry 6 -LsO https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64 \
|
|
&& chmod +x yq_linux_amd64 \
|
|
&& mv yq_linux_amd64 /usr/local/bin/yq
|
|
|
|
# Helm
|
|
RUN curl --retry 6 -Ls "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar -xz -C /tmp/ \
|
|
&& chmod +x /tmp/linux-amd64/helm \
|
|
&& mv /tmp/linux-amd64/helm /usr/local/bin/helm
|
|
|
|
# Kustomize
|
|
COPY --from=kustomize /go/bin/kustomize /usr/local/bin/kustomize
|
|
# Controller-gen
|
|
COPY --from=controller-gen /go/bin/controller-gen /usr/local/bin/controller-gen
|
|
|
|
## Final image
|
|
FROM golang:${GOLANG_VERSION}-alpine
|
|
LABEL maintainer="GitLab Distribution Team" \
|
|
description="Build base image for the GitLab Operator project."
|
|
COPY --from=build / /
|