feat: Add Dockerfile for containerization and implement database migrations for both SQLite and Postgres.

This commit is contained in:
2026-01-02 05:56:33 +01:00
parent c1c42f4fd9
commit d916218703
2 changed files with 32 additions and 7 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM rust:1.92 AS builder
WORKDIR /app
COPY . .
# Build the release binary
RUN cargo build --release -p template-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/template-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 ["./template-api"]