FROM golang:1.19 # Set destination for COPY WORKDIR /app # Download Go modules COPY go.mod go.sum ./ RUN go mod download # Copy the source code. Note the slash at the end, as explained in # https://docs.docker.com/engine/reference/builder/#copy COPY *.go ./ # Build RUN CGO_ENABLED=0 go build -o /web # Expose EXPOSE 8081 # Run CMD ["/web"]