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.2222
ARG ALPINE_VERSION=3.203+
ARG PROJECT=helmwave34
5+
# Bulder46
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder57
ENV GO111MODULE=on68
ENV CGO_ENABLED=07-
ENV PROJECT=helmwave8-
99
WORKDIR ${PROJECT}10-
1110
COPY go.mod go.sum ./1211
RUN go mod download1312
1413
# Copy src code from the host and compile it1514
COPY cmd cmd1615
COPY pkg pkg17-
RUN go build -a -o /${PROJECT} ./cmd/${PROJECT}1816
19-
### Base image with shell17+
RUN go build -a -o "/${PROJECT}" "./cmd/${PROJECT}"18+
19+
## Base image with shell2020
FROM alpine:${ALPINE_VERSION} as base-release2121
RUN apk --update --no-cache add ca-certificates && update-ca-certificates22-
ENTRYPOINT ["/bin/helmwave"]22+
ENTRYPOINT ["/bin/${PROJECT}}"]23+
2324
2425
### Base image with shell and debugging tools2526
FROM base-release as base-debug-release2627
RUN apk --update --no-cache add jq bash2728
COPY --chown=root:root --chmod=0775 --from=bitnami/kubectl:latest /opt/bitnami/kubectl/bin/kubectl /bin/kubectl2829
30+
2931
### Build with goreleaser3032
FROM base-release as goreleaser31-
COPY helmwave /bin/33+
COPY ${PROJECT} /bin/3234
3335
### Debug tag3436
FROM base-debug-release as debug-goreleaser35-
COPY helmwave /bin/37+
COPY ${PROJECT} /bin/3638
3739
### Build in docker3840
FROM base-release as release39-
COPY --from=builder /helmwave /bin/41+
COPY --from=builder /${PROJECT} /bin/4042
4143
### Scratch with build in docker4244
FROM scratch as scratch-release4345
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 655344749
4850
### Scratch with goreleaser4951
FROM scratch as scratch-goreleaser5052
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