Files
zeekayandHanzo Dev 86112af99e Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 19:15:44 -07:00

30 lines
1.0 KiB
Docker

# syntax=docker/dockerfile:1.6
FROM --platform=$BUILDPLATFORM golang:1.27.1-alpine AS build
ENV GOTOOLCHAIN=auto
WORKDIR /src
RUN apk add --no-cache git ca-certificates tzdata \
&& echo 'nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin' >> /etc/passwd \
&& echo 'nonroot:x:65532:' >> /etc/group
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ENV CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH}
RUN go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" \
-o /out/relayd ./cmd/relayd
FROM scratch
LABEL org.opencontainers.image.source="https://github.com/luxfi/relay"
LABEL org.opencontainers.image.title="Lux Relay"
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /etc/group /etc/group
COPY --from=build /out/relayd /usr/local/bin/relayd
ENV PORT=7700
EXPOSE 7700
USER 65532:65532
ENTRYPOINT ["/usr/local/bin/relayd"]