diff --git a/Dockerfile b/Dockerfile index 8e4e9ac..c2fb25d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,17 @@ -# Stage 1 — compile sqlite-zstd against the container's own SQLite +# Stage 1 — compile sqlite-zstd + SQLite 3.49.1 FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim AS sqlite-zstd-builder RUN apt-get update && apt-get install -y --no-install-recommends \ - curl git libsqlite3-dev libzstd-dev pkg-config build-essential ca-certificates && \ + curl unzip git libzstd-dev pkg-config build-essential ca-certificates && \ rm -rf /var/lib/apt/lists/* +# Compile SQLite 3.49.1 as a shared library so the runtime image can use it +RUN curl -fsSL https://www.sqlite.org/2025/sqlite-amalgamation-3490100.zip -o /tmp/sqlite.zip && \ + unzip /tmp/sqlite.zip -d /tmp/ && \ + cd /tmp/sqlite-amalgamation-3490100 && \ + gcc -O2 -shared -fPIC -o /usr/local/lib/libsqlite3.so.0 sqlite3.c -ldl -lpthread + +# Install Rust and compile sqlite-zstd (uses bundled SQLite 3.49.1 — no patching needed) RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal ENV PATH="/root/.cargo/bin:${PATH}" @@ -19,13 +26,16 @@ FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim RUN apt-get update && apt-get install -y --no-install-recommends libzstd1 && \ rm -rf /var/lib/apt/lists/* +# Replace system SQLite 3.46.1 with 3.49.1 so it matches the extension +COPY --from=sqlite-zstd-builder /usr/local/lib/libsqlite3.so.0 /usr/local/lib/libsqlite3.so.0 +RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf && ldconfig + COPY --from=sqlite-zstd-builder /usr/local/lib/libsqlite_zstd.so /usr/local/lib/libsqlite_zstd.so # Install app COPY . /app WORKDIR /app -# Install dependencies RUN uv sync --no-config --frozen --compile-bytecode EXPOSE 8000