I want to use the multi stage build for my gaoling project, when I build the project locally for linux/windows/Mac I got 12.6 mb of size , I’ve currently small gaoling CLI program.
Now I want to build it with to build from it lightwhigt docker image with the
scratch option and build
I use the following, but when I check the image, I see that the size it
366MB , any idea what am I missing here?
It should be less then 20MB…
#build stage FROM golang:alpine as builder WORKDIR /go/src/tzf ADD . /go/src/tzf RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o ova tzf RUN apk add --no-cache git FROM golang:alpine RUN mkdir /build ADD . /build/ WORKDIR /build RUN CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o ova tzf FROM scratch COPY --from=builder /build/main /app/ WORKDIR /app CMD [“./ova -v"]