mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-29 08:01:13 +00:00
## Description Tested here: https://github.com/n0-computer/iroh/actions/runs/9992457651/job/27617587850?pr=2520 Results here: - https://hub.docker.com/r/n0computer/iroh - https://hub.docker.com/r/n0computer/iroh-relay - https://hub.docker.com/r/n0computer/iroh-dns-server Will only trigger on new releases. Pretty happy, images are very slim and builds are pretty snappy. Test it out with `docker run -p 9090:9090 -p 4919:4919/udp -Pit n0computer/iroh:latest --rpc-addr 0.0.0.0:4919 start` Closes #1371 ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
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-dns-server"]
|
|
CMD [""] |