aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorjhalter <868228+jhalter@users.noreply.github.com>2022-06-04 16:01:18 -0700
committerGitHub <noreply@github.com>2022-06-04 16:01:18 -0700
commit75b7ce6f806644d7b3d62c7dfaced270ed06154d (patch)
tree4650546c40282015a3f0a94a47ca2630de7d44c6 /Dockerfile
parent4a0b69af8997eb3ae1da4d50c35073c073ce04d8 (diff)
Use multi-stage build for smaller Docker image
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile15
1 files changed, 9 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 5ed9bfc..86cbd63 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,16 @@
-FROM golang:1.18
+FROM golang:1.18 AS builder
WORKDIR /app
COPY . .
-RUN go build -o /app/server/server cmd/mobius-hotline-server/main.go \
- && chmod a+x /app/server/server
+RUN CGO_ENABLED=0 go build -o /app/server/server cmd/mobius-hotline-server/main.go && chmod a+x /app/server/server
-EXPOSE 5500 5501
+FROM scratch
+
+WORKDIR /app/
+COPY --from=builder /app/server/server ./
+COPY --from=builder /app/cmd/mobius-hotline-server/mobius/config /usr/local/var/mobius/config
-WORKDIR /app/server/
-CMD ["./server"]
+EXPOSE 5500 5501
+CMD ["/app/server"]