# df-relay 跨端中继(Phase3 云端部署,u-work.1216.top)
# multi-stage:rust:slim 编译 df-relay → debian:slim 运行(static-ish binary)
#
# 构建(context = repo 根,workspace):
#   docker build -f crates/df-relay/Dockerfile -t df-relay .
# 运行(容器内 :8080,映射宿主 :9180,避开测试机 8080 占用):
#   docker run -d --name df-relay --restart unless-stopped -p 9180:8080 df-relay

FROM rust:1.85-slim AS builder
WORKDIR /build
COPY . .
RUN cargo build --release -p df-relay

FROM debian:bookworm-slim
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/target/release/df-relay /usr/local/bin/df-relay
ENV DF_RELAY_ADDR=0.0.0.0:8080
EXPOSE 8080
CMD ["df-relay"]
