diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..378b6cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:alpine AS builder + +# Add source code +ADD ./ /go/src/github.com/dhax/go-base/ + +RUN cd /go/src/github.com/dhax/go-base && \ + go build && \ + mv ./go-base /usr/bin/go-base + +# Multi-Stage production build +FROM alpine + +RUN apk add --update ca-certificates + +# Retrieve the binary from the previous stage +COPY --from=builder /usr/bin/go-base /usr/local/bin/go-base + +# Set the binary as the entrypoint of the container +CMD ["go-base", "serve"] \ No newline at end of file