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`.
This commit is contained in:
2026-07-20 12:29:46 +08:00
parent 15a6658d1c
commit c8f670e920
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -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"]