Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (37 loc) · 1.55 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (37 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Multi-stage build: Build helm-operator with updated Go version
FROM golang:1.26.6-alpine AS go-builder
# Install necessary build tools
RUN apk add --no-cache git make bash
# Clone and build operator-sdk/helm-operator
WORKDIR /workspace
COPY patches/ /workspace/patches/
RUN git clone --depth 1 --branch v1.42.0 https://github.com/operator-framework/operator-sdk.git && \
cd operator-sdk && \
git apply /workspace/patches/operator-sdk-upgrade-error-logging.patch && \
go get golang.org/x/crypto@v0.57.0 \
golang.org/x/net@v0.58.0 \
google.golang.org/grpc@v1.83.2 \
go.opentelemetry.io/otel@v1.44.0 \
go.opentelemetry.io/otel/sdk@v1.44.0 \
go.opentelemetry.io/otel/trace@v1.44.0 \
go.opentelemetry.io/otel/metric@v1.44.0 \
github.com/moby/spdystream@v0.5.1 \
github.com/containerd/containerd@v1.7.33 \
helm.sh/helm/v3@v3.20.2 \
oras.land/oras-go/v2@v2.6.2 \
github.com/google/cel-go@v0.29.0 && \
go mod tidy && \
make build/helm-operator
# Final stage with distroless base
FROM gcr.io/distroless/static-debian12:nonroot
# Copy the rebuilt helm-operator binary with updated Go version
COPY --from=go-builder /workspace/operator-sdk/build/helm-operator /usr/local/bin/helm-operator
# Copy necessary files
ENV HOME=/opt/helm
COPY --chmod=555 watches.yaml ${HOME}/watches.yaml
COPY --chmod=555 helm-charts ${HOME}/helm-charts
WORKDIR ${HOME}
# Run as non-root user
USER nonroot:nonroot
ENTRYPOINT ["/usr/local/bin/helm-operator"]
CMD ["run"]