FROM golang:latest as builder RUN mkdir -p /go/src/folder WORKDIR /go/src/folder COPY /src . RUN go get -d RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o main . FROM alpine:latest WORKDIR / COPY --from=builder /go/src/folder/main . EXPOSE 8080 CMD ["/main"]