mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-24 09:39:08 -05:00
44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
FROM docker.io/library/rust:1.65.0@sha256:1bca14676a365d0ed37a1e2a1da86c2bcf883fdf6e6886469434763d94d4afd5 as builder
|
|
|
|
RUN USER=root cargo new --bin nostr-rs-relay
|
|
WORKDIR ./nostr-rs-relay
|
|
COPY ./Cargo.toml ./Cargo.toml
|
|
COPY ./Cargo.lock ./Cargo.lock
|
|
RUN cargo build --release
|
|
RUN rm src/*.rs
|
|
|
|
COPY ./src ./src
|
|
|
|
RUN rm ./target/release/deps/nostr*relay*
|
|
RUN cargo build --release
|
|
|
|
FROM docker.io/library/debian:bullseye-20221024-slim@sha256:76cdda8fe5eb597ef5e712e4c9a9f5f1fb119e69f353daaa7bd6d0f6e66e541d
|
|
|
|
ARG APP=/usr/src/app
|
|
ARG APP_DATA=/usr/src/app/db
|
|
RUN apt-get update \
|
|
&& apt-get install -y ca-certificates tzdata sqlite3 libc6 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
EXPOSE 8080
|
|
|
|
ENV TZ=Etc/UTC \
|
|
APP_USER=appuser
|
|
|
|
RUN groupadd $APP_USER \
|
|
&& useradd -g $APP_USER $APP_USER \
|
|
&& mkdir -p ${APP} \
|
|
&& mkdir -p ${APP_DATA}
|
|
|
|
COPY --from=builder /nostr-rs-relay/target/release/nostr-rs-relay ${APP}/nostr-rs-relay
|
|
|
|
RUN chown -R $APP_USER:$APP_USER ${APP}
|
|
|
|
USER $APP_USER
|
|
WORKDIR ${APP}
|
|
|
|
ENV RUST_LOG=info,nostr_rs_relay=info
|
|
ENV APP_DATA=${APP_DATA}
|
|
|
|
CMD ./nostr-rs-relay --db ${APP_DATA}
|