aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile25
1 files changed, 25 insertions, 0 deletions
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