mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
77 lines
2.6 KiB
Docker
77 lines
2.6 KiB
Docker
ARG GOLANG_VERSION=1.16
|
|
|
|
## Kustomize
|
|
FROM golang:${GOLANG_VERSION} as kustomize
|
|
|
|
ARG KUSTOMIZE_VERSION=3.8.10
|
|
ENV GOPROXY="https://proxy.golang.org/"
|
|
|
|
RUN apt-get update && apt-get install -y gcc && apt-get clean
|
|
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} 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} as build
|
|
|
|
LABEL maintainer="GitLab Distribution Team" \
|
|
description="Build base image for the GitLab Operator project."
|
|
|
|
ARG KUBEBUILDER_VERSION=2.3.1
|
|
ARG OPERATOR_SDK_VERSION=1.13.1
|
|
ARG OPM_VERSION=1.19.1
|
|
ARG YQ_VERSION=4.7.0
|
|
ARG HELM_VERSION=3.5.2
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
podman buildah curl make gcc git bash coreutils \
|
|
&& apt-get clean
|
|
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
|
|
|
|
# Operator SDK
|
|
RUN curl --retry 6 -LsO https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 \
|
|
&& chmod +x operator-sdk_linux_amd64 \
|
|
&& mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
|
|
|
|
# OPM
|
|
RUN curl --retry 6 -LsO https://github.com/operator-framework/operator-registry/releases/download/v${OPM_VERSION}/linux-amd64-opm \
|
|
&& chmod +x linux-amd64-opm \
|
|
&& mv linux-amd64-opm /usr/local/bin/opm
|
|
|
|
# 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}
|
|
LABEL maintainer="GitLab Distribution Team" \
|
|
description="Build base image for the GitLab Operator project."
|
|
COPY --from=build / /
|