New ๐ŸŒŠ wave for @helm

Commit 34774433

347744335c62Merged

Dmitriy Zhilyaev <[email protected]> ยท 2 years ago ยท 1 file ยท ~1 modified

Description

feat: Dockerfile build specific binary with build-arg

Signed-off-by: Dmitriy Zhilyaev [email protected]

Details

Commit
347744335c62
Parent
880c6924152b

DockerfilemodifiedView file

@@ -1,53 +1,55 @@
11 ARG GOLANG_VERSION=1.22
22 ARG ALPINE_VERSION=3.20
3+ARG PROJECT=helmwave
34
5+# Bulder
46 FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
57 ENV GO111MODULE=on
68 ENV CGO_ENABLED=0
7-ENV PROJECT=helmwave
8-
99 WORKDIR ${PROJECT}
10-
1110 COPY go.mod go.sum ./
1211 RUN go mod download
1312
1413 # Copy src code from the host and compile it
1514 COPY cmd cmd
1615 COPY pkg pkg
17-RUN go build -a -o /${PROJECT} ./cmd/${PROJECT}
1816
19-### Base image with shell
17+RUN go build -a -o "/${PROJECT}" "./cmd/${PROJECT}"
18+
19+## Base image with shell
2020 FROM alpine:${ALPINE_VERSION} as base-release
2121 RUN apk --update --no-cache add ca-certificates && update-ca-certificates
22-ENTRYPOINT ["/bin/helmwave"]
22+ENTRYPOINT ["/bin/${PROJECT}}"]
23+
2324
2425 ### Base image with shell and debugging tools
2526 FROM base-release as base-debug-release
2627 RUN apk --update --no-cache add jq bash
2728 COPY --chown=root:root --chmod=0775 --from=bitnami/kubectl:latest /opt/bitnami/kubectl/bin/kubectl /bin/kubectl
2829
30+
2931 ### Build with goreleaser
3032 FROM base-release as goreleaser
31-COPY helmwave /bin/
33+COPY ${PROJECT} /bin/
3234
3335 ### Debug tag
3436 FROM base-debug-release as debug-goreleaser
35-COPY helmwave /bin/
37+COPY ${PROJECT} /bin/
3638
3739 ### Build in docker
3840 FROM base-release as release
39-COPY --from=builder /helmwave /bin/
41+COPY --from=builder /${PROJECT} /bin/
4042
4143 ### Scratch with build in docker
4244 FROM scratch as scratch-release
4345 COPY --from=base-release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
44-COPY --from=builder /helmwave /bin/
45-ENTRYPOINT ["/bin/helmwave"]
46+COPY --from=builder /${PROJECT} /bin/
47+ENTRYPOINT ["/bin/${PROJECT}"]
4648 USER 65534
4749
4850 ### Scratch with goreleaser
4951 FROM scratch as scratch-goreleaser
5052 COPY --from=base-release /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
51-COPY helmwave /bin/
52-ENTRYPOINT ["/bin/helmwave"]
53+COPY ${PROJECT} /bin/
54+ENTRYPOINT ["/bin/${PROJECT}"]
5355 USER 65534