From d7dddca106206c59b978e932d9a5b2d628299f4f Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Sun, 15 Feb 2026 17:28:56 -0500 Subject: [PATCH] fix: Simplify Dockerfile to use sqlx offline mode - 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 --- docker/Dockerfile.api | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile.api b/docker/Dockerfile.api index da83652..b424702 100644 --- a/docker/Dockerfile.api +++ b/docker/Dockerfile.api @@ -6,16 +6,15 @@ RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/li WORKDIR /build -# Cache dependencies — copy manifests first -COPY Cargo.toml ./ -COPY Cargo.lock* ./ -RUN mkdir src && echo "fn main() {}" > src/main.rs -RUN cargo build --release 2>/dev/null || true - -# Now copy actual source and build +# Copy everything +COPY Cargo.toml Cargo.lock* ./ COPY src/ src/ COPY migrations/ migrations/ -RUN touch src/main.rs && cargo build --release + +# 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 @@ -25,7 +24,7 @@ RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/ WORKDIR /app COPY --from=builder /build/target/release/corrosion-api . -COPY migrations/ migrations/ +COPY --from=builder /build/migrations/ migrations/ ENV RUST_LOG=corrosion_api=info,tower_http=info