From 5703da545badfa9a977ea56263d64fcf3d365dcd Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Mon, 26 May 2025 12:06:02 -0700 Subject: [PATCH] fix: docker: fetch python deps ahead of copying in full source tree The current build order: 1. Copy in full source tree 2. Fetch python build dependencies 3. Build The issue with this is any source tree change causes the python dependencies to be re-fetched, then the rust components of those deps rebuilt. Instead, copy in just the .circleci directory, which informs the python build dependency fetch. After we have the python deps, then copy in the full source tree and build. --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b0a346e64..e78a7047e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,7 @@ RUN apt update \ && apt install --yes binutils build-essential curl pkg-config libssl-dev clang lld git patchelf protobuf-compiler zstd libz-dev \ && rm -rf /var/lib/{apt,dpkg,cache,log} -# Build influxdb3 -COPY . /influxdb3 +RUN mkdir /influxdb3 WORKDIR /influxdb3 ARG CARGO_INCREMENTAL=yes @@ -31,6 +30,7 @@ ENV CARGO_INCREMENTAL=$CARGO_INCREMENTAL \ PBS_VERSION=$PBS_VERSION # obtain python-build-standalone and configure PYO3_CONFIG_FILE +COPY .circleci /influxdb3/.circleci RUN \ sed -i "s/^readonly TARGETS=.*/readonly TARGETS=${PBS_TARGET}/" ./.circleci/scripts/fetch-python-standalone.bash && \ ./.circleci/scripts/fetch-python-standalone.bash /influxdb3/python-artifacts "${PBS_DATE}" "${PBS_VERSION}" && \ @@ -38,6 +38,8 @@ RUN \ sed -i 's#tmp/workspace#influxdb3#' "/influxdb3/python-artifacts/${PBS_TARGET}/pyo3_config_file.txt" && \ cat "/influxdb3/python-artifacts/${PBS_TARGET}/pyo3_config_file.txt" +COPY . /influxdb3 + RUN \ --mount=type=cache,id=influxdb3_rustup,sharing=locked,target=/usr/local/rustup \ --mount=type=cache,id=influxdb3_registry,sharing=locked,target=/usr/local/cargo/registry \