# Build Stage FROM rust:1.75 as builder WORKDIR /usr/src/app # Copy manifest files COPY Cargo.toml ./ # Copy source code and templates COPY src ./src COPY templates ./templates COPY static ./static # Build the application RUN cargo build --release # Runtime Stage FROM debian:bookworm-slim # Install required dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy the binary from builder COPY --from=builder /usr/src/app/target/release/table-server /app/table-server # Copy templates and static files COPY --from=builder /usr/src/app/templates /app/templates COPY --from=builder /usr/src/app/static /app/static # Create directory for config file RUN mkdir -p /app/data # Expose port EXPOSE 8080 # Set environment to use the data directory ENV CONFIG_PATH=/app/data/table_config.json # Run the binary CMD ["/app/table-server"]