diff options
| author | jhalter <868228+jhalter@users.noreply.github.com> | 2022-06-04 16:01:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-04 16:01:18 -0700 |
| commit | 75b7ce6f806644d7b3d62c7dfaced270ed06154d (patch) | |
| tree | 4650546c40282015a3f0a94a47ca2630de7d44c6 /Dockerfile | |
| parent | 4a0b69af8997eb3ae1da4d50c35073c073ce04d8 (diff) | |
Use multi-stage build for smaller Docker image
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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"] |