diff --git a/Dockerfile.gitlab-operator-build-base b/Dockerfile.gitlab-operator-build-base index a30ea53..3a15770 100644 --- a/Dockerfile.gitlab-operator-build-base +++ b/Dockerfile.gitlab-operator-build-base @@ -11,6 +11,22 @@ RUN mkdir /src && cd /src; \ go mod init tmp && \ go get sigs.k8s.io/kustomize/kustomize/v3@v${KUSTOMIZE_VERSION} +## Opm + +FROM golang:${GOLANG_VERSION}-alpine as opm +ARG OPM_VERSION=1.19.0 +ENV GOPROXY="https://proxy.golang.org/" +RUN apk add --no-cache gcc musl-dev + +## on Alpine needs to be built from scratch due to glibc vs musl issues +RUN mkdir -p /src \ + && curl -s -L -o /src/operator-registry-${OPM_VERSION}.tgz https://github.com/operator-framework/operator-registry/archive/refs/tags/v${OPM_VERSION}.tar.gz \ + && cd /src \ + && tar -xzf operator-registry-${OPM_VERSION}.tgz \ + && ln -s operator-registry operator-registry-${OPM_VERSION} \ + && cd operator-registry-${OPM_VERSION} \ + && make bin/opm + ## Controller-gen FROM golang:${GOLANG_VERSION}-alpine as controller-gen @@ -31,7 +47,7 @@ ARG KUBEBUILDER_VERSION=2.3.1 ARG YQ_VERSION=4.7.0 ARG HELM_VERSION=3.5.2 ARG OPERATORSDK_VERSION=1.13.0 -ARG OPM_VERSION=1.19.0 +# ARG OPM_VERSION=1.19.0 RUN apk add --no-cache podman buildah curl make gcc musl-dev git bash coreutils @@ -58,14 +74,10 @@ RUN curl --retry 6 -Ls "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.ta && chmod +x /tmp/linux-amd64/helm \ && mv /tmp/linux-amd64/helm /usr/local/bin/helm -RUN mkdir -p .build \ - && curl -s -L -o .build/operator-registry-${OPM_VERSION}.tgz https://github.com/operator-framework/operator-registry/archive/refs/tags/v${OPM_VERSION}.tar.gz \ - && cd .build \ - && tar -xzf operator-registry-${OPM_VERSION}.tgz \ - && cd operator-registry-${OPM_VERSION} \ - && make bin/opm \ - cp bin/opm /usr/local/bin/opm +# Opm +COPY --from=opm /src/operator-registry/bin/opm /usr/local/bin/opm +# Operator-SDK RUN curl -o /usr/local/bin/operator-sdk -L \ https://github.com/operator-framework/operator-sdk/releases/download/v${OPERATORSDK_VERSION}/operator-sdk_linux_amd64 \ ; chmod +x /usr/local/bin/operator-sdk