# Build stage FROM rust:1.70-slim as builder WORKDIR /app # Install build dependencies RUN apt-get update && apt-get install -y \ pkg-config \ libsqlite3-dev \ && rm -rf /var/lib/apt/lists/* # Copy source code COPY . . # Build the application RUN cargo build --release # Runtime stage FROM debian:bullseye-slim WORKDIR /app # Install runtime dependencies RUN apt-get update && apt-get install -y \ libsqlite3-0 \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # Create necessary directories RUN mkdir -p /app/data /app/logs # Copy the binary from builder COPY --from=builder /app/target/release/formies-be /app/ # Copy configuration COPY config/default.toml /app/config/default.toml # Set environment variables ENV RUST_LOG=info ENV DATABASE_URL=/app/data/form_data.db ENV BIND_ADDRESS=0.0.0.0:8080 # Expose port EXPOSE 8080 # Set proper permissions RUN chown -R nobody:nogroup /app USER nobody # Run the application CMD ["./formies-be"]