Port Brave Sync server to Rust
Use SQLite for persistence and generate Rust protobuf bindings at build time. Add Docker image support for containerized deployment. Co-Authored-By: codex <[email protected]>
This commit is contained in:
commit
28826af88d
93 files changed
+11666
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
FROM rust:1.96-bookworm AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY Cargo.toml Cargo.lock build.rs ./
|
||||
COPY schema ./schema
|
||||
COPY src ./src
|
||||
|
||||
RUN cargo build --release --locked
|
||||
|
||||
FROM debian:bookworm-slim AS runtime
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gosu \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& useradd --system --uid 10001 --home-dir /var/lib/brave-sync brave-sync \
|
||||
&& mkdir -p /var/lib/brave-sync \
|
||||
&& chown -R brave-sync:brave-sync /var/lib/brave-sync
|
||||
|
||||
COPY --from=builder /app/target/release/brave-sync-rs /usr/local/bin/brave-sync-rs
|
||||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
WORKDIR /var/lib/brave-sync
|
||||
|
||||
ENV LISTEN_ADDR=0.0.0.0:8295
|
||||
ENV SQLITE_PATH=/var/lib/brave-sync/brave-sync.sqlite3
|
||||
|
||||
EXPOSE 8295
|
||||
VOLUME ["/var/lib/brave-sync"]
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["/usr/local/bin/brave-sync-rs"]
|
||||
Reference in new issue
Block a user