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.
fix/docker-python-deps-earlier
Adrian Thurston 2025-05-26 12:06:02 -07:00
parent 4dc61df77f
commit 5703da545b
1 changed files with 4 additions and 2 deletions

View File

@ -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 \