This repository has been archived by the owner on Mar 2, 2023. It is now read-only.
forked from hypnoglow/helm-s3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (36 loc) · 1.49 KB
/
Dockerfile
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
45
46
47
48
49
50
51
52
ARG ALPINE_VERSION=3.13.5
ARG GO_VERSION=1.16.4
FROM golang:${GO_VERSION}-alpine as build
ARG ARCH=amd64
ARG HELM_PLUGIN_VERSION=local
ARG YQ_VERSION=v4.7.1
ENV CGO_ENABLED=0 \
YQ_BINARY="yq_linux_${ARCH}"
RUN apk add --no-cache \
git \
wget
RUN wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O /usr/bin/yq && \
chmod +x /usr/bin/yq
WORKDIR /workspace/helm-s3
COPY . .
# Note: Using argument version.
#
# Note: Not using install hooks in container context.
RUN yq eval --inplace ".version = \"${HELM_PLUGIN_VERSION}\"" plugin.yaml && \
yq eval --inplace "del(.hooks)" plugin.yaml
RUN mkdir -p ./bin
RUN go build -ldflags "-X main.version=${HELM_PLUGIN_VERSION}" -o ./bin/helms3 ./cmd/helms3
FROM alpine:${ALPINE_VERSION} as helm
ARG HELM_VERSION=3.6.0
RUN apk add --update curl
# Install Helm binary for plugin installing.
RUN curl -L -s https://get.helm.sh/helm-v3.6.0-linux-amd64.tar.gz | tar -C /tmp -xvz && \
mv /tmp/linux-amd64/helm /usr/local/bin/helm && \
chmod +x /usr/local/bin/helm
FROM alpine:${ALPINE_VERSION}
COPY --from=build /workspace/helm-s3/LICENSE /root/.helm/cache/plugins/helm-s3/LICENSE
COPY --from=build /workspace/helm-s3/plugin.yaml /root/.helm/cache/plugins/helm-s3/plugin.yaml
COPY --from=build /workspace/helm-s3/bin/helms3 /root/.helm/cache/plugins/helm-s3/bin/helms3
COPY --from=helm /usr/local/bin/helm /usr/local/bin/helm
RUN mkdir -p /root/.helm/plugins \
&& helm plugin install /root/.helm/cache/plugins/helm-s3