Dockerfile (1113B)
1 FROM docker.io/library/rust:1.65.0@sha256:1bca14676a365d0ed37a1e2a1da86c2bcf883fdf6e6886469434763d94d4afd5 as builder 2 3 RUN USER=root cargo new --bin nostr-rs-relay 4 WORKDIR ./nostr-rs-relay 5 COPY ./Cargo.toml ./Cargo.toml 6 COPY ./Cargo.lock ./Cargo.lock 7 RUN cargo build --release 8 RUN rm src/*.rs 9 10 COPY ./src ./src 11 12 RUN rm ./target/release/deps/nostr*relay* 13 RUN cargo build --release 14 15 FROM docker.io/library/debian:bullseye-20221024-slim@sha256:76cdda8fe5eb597ef5e712e4c9a9f5f1fb119e69f353daaa7bd6d0f6e66e541d 16 17 ARG APP=/usr/src/app 18 ARG APP_DATA=/usr/src/app/db 19 RUN apt-get update \ 20 && apt-get install -y ca-certificates tzdata sqlite3 libc6 \ 21 && rm -rf /var/lib/apt/lists/* 22 23 EXPOSE 8080 24 25 ENV TZ=Etc/UTC \ 26 APP_USER=appuser 27 28 RUN groupadd $APP_USER \ 29 && useradd -g $APP_USER $APP_USER \ 30 && mkdir -p ${APP} \ 31 && mkdir -p ${APP_DATA} 32 33 COPY --from=builder /nostr-rs-relay/target/release/nostr-rs-relay ${APP}/nostr-rs-relay 34 35 RUN chown -R $APP_USER:$APP_USER ${APP} 36 37 USER $APP_USER 38 WORKDIR ${APP} 39 40 ENV RUST_LOG=info,nostr_rs_relay=info 41 ENV APP_DATA=${APP_DATA} 42 43 CMD ./nostr-rs-relay --db ${APP_DATA}