Skip to content

Commit

Permalink
Add helm CLI to image (#388)
Browse files Browse the repository at this point in the history
ref: https://issues.redhat.com/browse/ACM-9060

Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
  • Loading branch information
dhaiducek authored Feb 12, 2024
1 parent 85bd342 commit 3eac4a9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
14 changes: 9 additions & 5 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM registry.ci.openshift.org/stolostron/builder:go1.20-linux AS plugin-builder
ENV POLICY_GENERATOR_TAG=v1.13.0

WORKDIR go/src/github.com/open-cluster-management/multicloud-operators-subscription
WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription
COPY . .
RUN make -f Makefile build

WORKDIR /go/pkg/mod/helm.sh/helm/v3@v3.11.1
RUN CGO_ENABLED=1 make build

WORKDIR /policy-generator
RUN git clone --branch=${POLICY_GENERATOR_TAG} --depth=1 \
https://github.com/open-cluster-management-io/policy-generator-plugin
Expand All @@ -29,14 +32,15 @@ ENV OPERATOR=/usr/local/bin/multicluster-operators-subscription \
POLICY_GEN_ENABLE_HELM=true

# install operator binary
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-subscription ${OPERATOR}
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-subscription ${OPERATOR}
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin/
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin/
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin/

# install the policy generator Kustomize plugin
RUN mkdir -p $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator
COPY --from=plugin-builder /policy-generator/PolicyGenerator $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator
COPY --from=plugin-builder /go/pkg/mod/helm.sh/helm/v3@v3.11.1/bin/helm /usr/local/bin/

COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
Expand Down
10 changes: 7 additions & 3 deletions build/Dockerfile.prow
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ WORKDIR /go/src/github.com/stolostron/multicluster-operators-subscription
COPY . .
RUN make -f Makefile.prow build

WORKDIR /go/pkg/mod/helm.sh/helm/v3@v3.11.1
RUN CGO_ENABLED=1 make build

WORKDIR /policy-generator
RUN git clone --branch=${POLICY_GENERATOR_TAG} --depth=1 \
https://github.com/open-cluster-management-io/policy-generator-plugin
Expand All @@ -30,13 +33,14 @@ ENV OPERATOR=/usr/local/bin/multicluster-operators-subscription \

# install operator binary
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/multicluster-operators-subscription ${OPERATOR}
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin/
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin/
COPY --from=builder /go/src/github.com/stolostron/multicluster-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin/

# install the policy generator Kustomize plugin
RUN mkdir -p $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator
COPY --from=builder /policy-generator/PolicyGenerator $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator
COPY --from=plugin-builder /go/pkg/mod/helm.sh/helm/v3@v3.11.1/bin/helm /usr/local/bin/

COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
Expand Down
14 changes: 9 additions & 5 deletions build/Dockerfile.rhtap
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS plugin-builder
ENV POLICY_GENERATOR_TAG=v1.13.0

WORKDIR go/src/github.com/open-cluster-management/multicloud-operators-subscription
WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription
COPY . .
RUN make -f Makefile build

WORKDIR /go/pkg/mod/helm.sh/helm/v3@v3.11.1
RUN CGO_ENABLED=1 make build

WORKDIR /policy-generator
RUN git clone --branch=${POLICY_GENERATOR_TAG} --depth=1 \
https://github.com/open-cluster-management-io/policy-generator-plugin
Expand All @@ -29,14 +32,15 @@ ENV OPERATOR=/usr/local/bin/multicluster-operators-subscription \
POLICY_GEN_ENABLE_HELM=true

# install operator binary
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-subscription ${OPERATOR}
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin
COPY --from=plugin-builder go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-subscription ${OPERATOR}
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/multicluster-operators-placementrule /usr/local/bin/
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/uninstall-crd /usr/local/bin/
COPY --from=plugin-builder /go/src/github.com/open-cluster-management/multicloud-operators-subscription/build/_output/bin/appsubsummary /usr/local/bin/

# install the policy generator Kustomize plugin
RUN mkdir -p $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator
COPY --from=plugin-builder /policy-generator/PolicyGenerator $KUSTOMIZE_PLUGIN_HOME/policy.open-cluster-management.io/v1/policygenerator/PolicyGenerator
COPY --from=plugin-builder /go/pkg/mod/helm.sh/helm/v3@v3.11.1/bin/helm /usr/local/bin/

COPY build/bin /usr/local/bin
RUN /usr/local/bin/user_setup
Expand Down

0 comments on commit 3eac4a9

Please sign in to comment.