This tool helps you generate Dockerfiles for your Go applications. Simply paste your code and generate a Dockerfile optimized for production.
FROM golang:alpine AS builder
WORKDIR /go/src/hello
RUN apk add --no-cache gcc libc-dev
ADD src/go.* /go/src/hello/
RUN go mod download
ADD src/app.go .
RUN GOOS=linux GOARCH=amd64 go build -tags=netgo app.go
FROM scratch
COPY --from=builder /go/src/hello/app /app
CMD ["/app"]
Consider adding more features like multi-stage builds, environment variable support, and more.
For more information on Docker and Go, check out these resources: