Files
nostr-relay/Dockerfile
T
2025-06-02 23:31:11 +08:00

21 lines
757 B
Docker

FROM rust:alpine AS builder
RUN apk add --no-cache musl-dev musl-utils gcc
WORKDIR /usr/src/app
ENV RUSTFLAGS="-C target-feature=+crt-static"
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
rustup target add x86_64-unknown-linux-musl \
&& cargo fetch --locked --target x86_64-unknown-linux-musl
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo build --release --target x86_64-unknown-linux-musl
FROM alpine:latest
RUN apk add --no-cache libgcc
COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/nostr-relay /usr/local/bin/
CMD ["nostr-relay"]