From c8f670e920b72dc6a78e68948df88ec88cc9fef2 Mon Sep 17 00:00:00 2001 From: TZGyn Date: Mon, 20 Jul 2026 12:29:46 +0800 Subject: [PATCH] Add Dockerfile to deploy the relay server Multi-stage build: compiles with CGO disabled in golang:1.25-alpine, runs the static binary in a plain alpine:3.20 image. Defaults to "share relay" on port 9009; override with extra args at `docker run`. --- .dockerignore | 4 ++++ Dockerfile | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7806c32 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.git +reference/ +test/ +share diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de7ab70 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.25-alpine AS build +WORKDIR /src +COPY go.mod go.sum ./ +RUN go mod download +COPY . . +RUN CGO_ENABLED=0 go build -o /out/share . + +FROM alpine:3.20 +COPY --from=build /out/share /usr/local/bin/share +EXPOSE 9009 +ENTRYPOINT ["share"] +CMD ["relay"]