nxtgauge-backend-rust/Dockerfile.template
Ashwin Kumar 219960399b fix: update Dockerfiles to use debian:trixie-slim for glibc 2.38+ compatibility
Fixed glibc version mismatch between rust:latest builder (glibc 2.38+)
and debian:bookworm-slim runtime (glibc 2.36). This was causing:
- ./companies: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.38 not found
- ./payments: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.38 not found
- Similar errors for users service

Updated all 19 service Dockerfiles + Dockerfile.template to use
debian:trixie-slim which includes glibc 2.38+.
2026-04-09 11:48:46 +02:00

41 lines
840 B
Text

# Build stage
FROM rust:1.79-slim AS builder
WORKDIR /usr/src/app
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml ./
COPY crates ./crates
COPY apps ./apps
# Build the application (release mode for smaller binary)
RUN cargo build --release --bin ${BIN_NAME}
# Runtime stage
FROM debian:trixie-slim AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN useradd -m -u 1000 appuser
WORKDIR /app
# Copy binary from builder
COPY --from=builder /usr/src/app/target/release/${BIN_NAME} ./${BIN_NAME}
# Switch to non-root user
USER appuser
# Run the binary
CMD ["./${BIN_NAME}"]