mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-29 16:01:19 +00:00
## Description - Enable binding of the RPC endpoint to arbitrary addresses - Add Dockerfile for iroh ## Breaking Changes - changed `iroh::node::Node::my_rpc_port` is now `my_rpc_addr` and returns `Option<SocketAddr>` - `iroh::node::Builder::rpc_endpoint` takes `Option<SocketAddr> instead of `Option<u16>` - added `iroh::node::Builder::enable_rpc_with_addr` allowing to specify on which address + port to bind to ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [x] Self-review. - [x] Documentation updates if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented. --------- Co-authored-by: dignifiedquire <me@dignifiedquire.com>
84 lines
1.9 KiB
Docker
84 lines
1.9 KiB
Docker
FROM rust:alpine AS chef
|
|
|
|
RUN update-ca-certificates
|
|
RUN apk add --no-cache musl-dev openssl-dev pkgconfig
|
|
RUN cargo install cargo-chef
|
|
WORKDIR /iroh
|
|
|
|
FROM chef AS planner
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
### Builder image
|
|
FROM chef AS rust_builder
|
|
|
|
RUN update-ca-certificates
|
|
RUN apk add --no-cache musl-dev openssl-dev pkgconfig
|
|
|
|
COPY --from=planner /iroh/recipe.json recipe.json
|
|
# Build dependencies - this is the caching Docker layer!
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
WORKDIR /iroh
|
|
|
|
# copy entire workspace
|
|
COPY . .
|
|
|
|
RUN cargo build --release --all-features
|
|
|
|
### Target image
|
|
FROM alpine:latest as iroh
|
|
|
|
RUN apk update && apk add ca-certificates && update-ca-certificates
|
|
|
|
# Copy our build, changing owndership to distroless-provided "nonroot" user,
|
|
# (65532:65532)
|
|
COPY --from=rust_builder /iroh/target/release/iroh /iroh
|
|
|
|
RUN chmod +x /iroh
|
|
|
|
WORKDIR /
|
|
|
|
# expose the default ports
|
|
# rpc, nat-pmp, metrics, iroh_node_ipv4, iroh_node_ipv6
|
|
EXPOSE 4919/udp 5351 9090 11204/udp 11205/udp
|
|
ENTRYPOINT ["/iroh"]
|
|
CMD ["start"]
|
|
|
|
### Target image
|
|
FROM alpine:latest as iroh-relay
|
|
|
|
RUN apk update && apk add ca-certificates && update-ca-certificates
|
|
|
|
# Copy our build, changing owndership to distroless-provided "nonroot" user,
|
|
# (65532:65532)
|
|
COPY --from=rust_builder /iroh/target/release/iroh-relay /iroh-relay
|
|
|
|
RUN chmod +x /iroh-relay
|
|
|
|
WORKDIR /
|
|
|
|
# expose the default ports
|
|
# http, https, stun, metrics
|
|
EXPOSE 80 443 3478/udp 9090
|
|
ENTRYPOINT ["/iroh-relay"]
|
|
CMD [""]
|
|
|
|
### Target image
|
|
FROM alpine:latest as iroh-dns-server
|
|
|
|
RUN apk update && apk add ca-certificates && update-ca-certificates
|
|
|
|
# Copy our build, changing owndership to distroless-provided "nonroot" user,
|
|
# (65532:65532)
|
|
COPY --from=rust_builder /iroh/target/release/iroh-dns-server /iroh-dns-server
|
|
|
|
RUN chmod +x /iroh-dns-server
|
|
|
|
WORKDIR /
|
|
|
|
# expose the default ports
|
|
# dns, metrics
|
|
EXPOSE 53/udp 9090
|
|
ENTRYPOINT ["/iroh-relay"]
|
|
CMD [""] |