All checks were successful
Test Asgard Runner / test (push) Successful in 2s
- Remove complex build caching - Set SQLX_OFFLINE=true to skip compile-time query verification - Queries still validated at runtime - Eliminates need for DATABASE_URL during Docker build
34 lines
847 B
Docker
34 lines
847 B
Docker
# Multi-stage build for Corrosion API
|
|
# Stage 1: Build the Rust binary
|
|
FROM rust:latest AS builder
|
|
|
|
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /build
|
|
|
|
# Copy everything
|
|
COPY Cargo.toml Cargo.lock* ./
|
|
COPY src/ src/
|
|
COPY migrations/ migrations/
|
|
|
|
# Build with sqlx offline mode to skip compile-time query verification
|
|
# Runtime validation still occurs - just no compile-time type checking
|
|
ENV SQLX_OFFLINE=true
|
|
RUN cargo build --release
|
|
|
|
# Stage 2: Runtime image
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /build/target/release/corrosion-api .
|
|
COPY --from=builder /build/migrations/ migrations/
|
|
|
|
ENV RUST_LOG=corrosion_api=info,tower_http=info
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["./corrosion-api"]
|