| 1 | # Build only the relay. The fixed vendored modules preserve go.mod replacements; |
| 2 | # this target does not embed or download Cage virtual-machine images. |
| 3 | FROM golang:1.26.10-bookworm AS build |
| 4 | WORKDIR /src |
| 5 | COPY go.mod go.sum ./ |
| 6 | COPY third_party ./third_party |
| 7 | COPY internal/relay ./internal/relay |
| 8 | COPY cmd/cage-relay ./cmd/cage-relay |
| 9 | RUN CGO_ENABLED=0 go build -mod=readonly -trimpath -ldflags="-s -w" -o /out/cage-relay ./cmd/cage-relay |
| 10 | |
| 11 | FROM scratch |
| 12 | COPY --from=build /out/cage-relay /cage-relay |
| 13 | USER 65532:65532 |
| 14 | EXPOSE 8787 |
| 15 | ENTRYPOINT ["/cage-relay"] |