- Add main application logic in `api/src/main.rs` to initialize server, database, and services. - Create authentication routes in `api/src/routes/auth.rs` for login, register, logout, and user info retrieval. - Implement configuration route in `api/src/routes/config.rs` to expose application settings. - Define application state management in `api/src/state.rs` to share user service and configuration. - Set up Docker Compose configuration in `compose.yml` for backend, worker, and database services. - Establish domain logic in `domain` crate with user entities, repositories, and services. - Implement SQLite user repository in `infra/src/user_repository.rs` for user data persistence. - Create database migration handling in `infra/src/db.rs` and session store in `infra/src/session_store.rs`. - Add necessary dependencies and features in `Cargo.toml` files for both `domain` and `infra` crates.
28 lines
562 B
Docker
28 lines
562 B
Docker
FROM rust:1.92 AS builder
|
|
|
|
WORKDIR /app
|
|
COPY . .
|
|
|
|
# Build the release binary
|
|
RUN cargo build --release -p api
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install OpenSSL (required for many Rust networking crates) and CA certificates
|
|
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /app/target/release/api .
|
|
|
|
|
|
# Create data directory for SQLite
|
|
RUN mkdir -p /app/data
|
|
|
|
ENV DATABASE_URL=sqlite:///app/data/template.db
|
|
ENV SESSION_SECRET=supersecretchangeinproduction
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["./api"]
|