aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorMichael Aldridge <aldridge.mac@gmail.com>2021-01-10 01:52:05 -0800
committerraul-te <46945030+raul-te@users.noreply.github.com>2021-01-11 14:26:50 -0800
commitfa13436d4ceba235081c9eedb8d6f586ea21e7aa (patch)
treef14466e44f839fa939ec72a1a0da8ffa64d40dc2 /Dockerfile
parent54548c1e857ef55bd37cf0b4bfd66f560bb41997 (diff)
Dockerfile: Add docker build
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile19
1 files changed, 19 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..3c9da89
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,19 @@
+FROM golang:1.15-alpine AS build
+
+WORKDIR /shoelaces
+COPY . .
+
+RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w -extldflags "-static"' -o /tmp/shoelaces . && \
+printf "---\nnetworkMaps:\n" > /tmp/mappings.yaml
+
+# Final container has basically nothing in it but the executable
+FROM scratch
+COPY --from=build /tmp/shoelaces /shoelaces
+
+WORKDIR /data
+COPY --from=build /tmp/mappings.yaml mappings.yaml
+COPY --from=build /shoelaces/web /web
+ENV DOMAIN=0.0.0.0
+ENV PORT=8081
+ENTRYPOINT ["/shoelaces"]
+CMD ["-data-dir", "/data", "-static-dir", "/web"]
nihil fit ex nihilo