FROM golang:alpine as builder RUN mkdir /build COPY main.go /build/main.go WORKDIR /build RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o main . FROM scratch COPY --from=builder /build/main /main EXPOSE 80 CMD ["./main"]