aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorjackyzha0 <[email protected]>2020-05-09 14:48:51 -0700
committerjackyzha0 <[email protected]>2020-05-09 14:48:51 -0700
commit8026f03b111d65ffbac7f11fc056abef430a77f8 (patch)
tree49ee3cd9b69866e53068476dbbe8d27d6f386911 /Dockerfile
parentip changes and remove some debug (diff)
downloadctrl-v-8026f03b111d65ffbac7f11fc056abef430a77f8.tar.xz
ctrl-v-8026f03b111d65ffbac7f11fc056abef430a77f8.zip
add dockerfile and makefile
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