From fa13436d4ceba235081c9eedb8d6f586ea21e7aa Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Sun, 10 Jan 2021 01:52:05 -0800 Subject: Dockerfile: Add docker build --- Dockerfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Dockerfile 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"] -- cgit v1.2.3