build/Dockerfile
FROM golang:1.16.2-alpine AS build RUN apk add --update --no-cache ca-certificates gcc g++ libc-dev WORKDIR /code # Download DependenciesCOPY go.mod .COPY go.sum .RUN go mod download # TestCOPY . .RUN go generate ./... && go vet ./... && go test ./... # BuildRUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-extldflags -static" -o /go/bin/rangedb ./cmd/rangedb # Prepare final imageFROM scratch AS releaseCOPY --from=build /go/bin/rangedb /bin/rangedbENTRYPOINT ["/bin/rangedb"]EXPOSE 8080