37 lines
1.2 KiB
Docker
37 lines
1.2 KiB
Docker
FROM registry.hub.docker.com/library/golang:1.20.5-alpine3.18 as builder
|
|
|
|
RUN apk update && apk upgrade && \
|
|
apk add --no-cache bash build-base
|
|
|
|
WORKDIR /opt/flux-helm-controller
|
|
|
|
COPY go.mod .
|
|
COPY go.sum .
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
|
|
ARG GOARCH
|
|
RUN GOOS=linux CGO_ENABLED=0 go build -tags build -o /usr/local/bin/flux-helm-controller main.go
|
|
|
|
|
|
FROM ghcr.io/allanger/dumb-downloader as dudo
|
|
RUN apt-get update -y && apt-get install tar -y
|
|
ARG HELM_VERSION=v3.12.1
|
|
ENV RUST_LOG=info
|
|
RUN dudo -l "https://get.helm.sh/helm-{{ version }}-{{ os }}-{{ arch }}.tar.gz" -d /tmp/helm.tar.gz -p $HELM_VERSION
|
|
RUN tar -xf /tmp/helm.tar.gz -C /tmp && rm -f /tmp/helm.tar.gz
|
|
RUN mkdir /out && for bin in `find /tmp | grep helm`; do cp $bin /out/; done
|
|
RUN chmod +x /out/helm
|
|
|
|
# Final container
|
|
FROM registry.hub.docker.com/library/alpine:3.18
|
|
LABEL org.opencontainers.image.authors="Nikolai Rodionov<allanger@zohomail.com>"
|
|
COPY --from=dudo /out/ /usr/bin
|
|
RUN apk update --no-cache && apk add openssh git yq rsync --no-cache
|
|
|
|
# # install operator binary
|
|
COPY --from=builder /usr/local/bin/flux-helm-controller /usr/local/bin/flux-helm-controller
|
|
|
|
ENTRYPOINT ["/usr/local/bin/flux-helm-controller"]
|