feat: add docker ci

This commit is contained in:
2026-04-09 15:50:59 +02:00
parent 05bc471d01
commit 248dc3d634
6 changed files with 135 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# ── Build Stage ──────────────────────────────────────────────────────────────
FROM rust:1.86.0-slim AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release
RUN rm -rf src
# Build actual app
COPY src ./src
RUN cargo build --release
# ── Runtime Stage ─────────────────────────────────────────────────────────────
FROM debian:bookworm-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m appuser
USER appuser
COPY --from=builder /app/target/release/chat .
EXPOSE 3000
CMD ["./chat"]