From e264f9f238d716be4b09a3866576eb2867ba8d2e Mon Sep 17 00:00:00 2001 From: Aditya Gupta Date: Thu, 25 Jun 2026 10:22:40 +0530 Subject: [PATCH] feat(docker): Added docker setup --- .dockerignore | 6 ++++++ Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 8 ++++---- 3 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2ac4031 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +target/ +.git/ +.env +data.db +data.db-shm +data.db-wal diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..48a6541 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# Build stage +FROM rust:1.80-slim as builder + +WORKDIR /usr/src/app + +# Install dependencies required for building +RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/* + +# Copy the manifests +COPY Cargo.toml Cargo.lock ./ + +# Create a dummy main.rs to build dependencies and cache them +RUN mkdir src && \ + echo "fn main() {}" > src/main.rs && \ + cargo build --release && \ + rm -rf src + +# Copy the actual source code and migrations +COPY src ./src +COPY migrations ./migrations + +# Touch main.rs to ensure cargo rebuilds it +RUN touch src/main.rs && cargo build --release + +# Runtime stage +FROM debian:bookworm-slim + +WORKDIR /app + +# Install runtime dependencies +RUN apt-get update && apt-get install -y ca-certificates sqlite3 && rm -rf /var/lib/apt/lists/* + +# Copy the compiled binary from the builder stage +COPY --from=builder /usr/src/app/target/release/bootstrap-auth-server /usr/local/bin/bootstrap-auth-server + +# Set environment variables +ENV SERVER_PORT=3000 +ENV DATABASE_URL="sqlite://data.db?mode=rwc" +ENV RUST_LOG="bootstrap_auth_server=debug,info" + +# Expose the port +EXPOSE 3000 + +# Run the binary +ENTRYPOINT ["bootstrap-auth-server"] diff --git a/README.md b/README.md index e7b3036..1c27e6f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Architecture: Asymmetric Cryptography (RSA) Authentication & E2E Secrets Sync +# Asymmetric Cryptography (RSA) Authentication & E2E Secrets Sync -This architecture replaces static tokens with an asymmetric key pair (RSA or Ed25519) generated on each client device. This provides challenge-response authentication and end-to-end encryption for synchronized secrets. +This replaces static tokens with an asymmetric key pair (RSA or Ed25519) generated on each client device. This provides challenge response authentication and e2e encryption for synchronized secrets. --- @@ -9,9 +9,9 @@ This architecture replaces static tokens with an asymmetric key pair (RSA or Ed2 ```mermaid sequenceDiagram autonumber - actor User as User (Aditya) + actor User as User participant DevB as Device B (New Machine) - participant Server as Auth Server (Node.js/Go) + participant Server as Auth Server (Rust) participant DevA as Device A (Trusted Machine) Note over DevB: 1. Generate RSA key pair locally if missing
(~/.config/bootstrap/id_rsa)