From 8026f03b111d65ffbac7f11fc056abef430a77f8 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 9 May 2020 14:48:51 -0700 Subject: add dockerfile and makefile --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5a14889 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +## Build stage +FROM golang:alpine AS builder +ENV GO111MODULE=on + +# Copy files to image +COPY . /app/src +WORKDIR /app/src + +RUN apk add git ca-certificates +RUN go mod download + +# Build image +RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/app + +## Image creation stage +FROM scratch + +# Copy app +COPY --from=builder /go/bin/app /go/bin/app + +# Expose ports, change port to whatever you need to expose +EXPOSE 8080 + +# Run app +ENTRYPOINT ["/go/bin/app"] \ No newline at end of file -- cgit v1.2.3