feat(docker): Added docker setup

This commit is contained in:
2026-06-25 10:22:40 +05:30
parent 51373fa6ec
commit e264f9f238
3 changed files with 55 additions and 4 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
target/
.git/
.env
data.db
data.db-shm
data.db-wal

45
Dockerfile Normal file
View File

@@ -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"]

View File

@@ -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<br/>(~/.config/bootstrap/id_rsa)