fix: add Rust compiler to Dockerfile.database and Dockerfile.non_root for tiktoken on Python 3.14

This commit is contained in:
Harshit Jain 2026-02-11 02:15:04 +00:00
parent a766e8f172
commit 226643eefe
2 changed files with 18 additions and 2 deletions

View file

@ -16,17 +16,26 @@ RUN apk add --no-cache \
bash \
gcc \
git \
curl \
build-base \
openssl \
openssl-dev
RUN python -m pip install build
RUN python -m pip install --upgrade pip setuptools && \
python -m pip install build wheel cmake setuptools_rust maturin
# Install build dependencies needed for git-based packages
RUN pip install --no-cache-dir hatchling hatch-vcs
# Configure Rust environment for building Rust-backed Python wheels (tiktoken, etc.)
ENV CARGO_HOME=/root/.cargo
ENV PATH=/root/.cargo/bin:$PATH
# Allow forward-compatible ABI for PyO3-based packages on Python 3.14
ENV PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
rustup default stable
# Copy the current directory contents into the container at /app
COPY . .

View file

@ -19,17 +19,24 @@ RUN for i in 1 2 3; do \
lld \
gcc \
git \
curl \
linux-headers \
build-base \
bash \
nodejs \
npm && break || sleep 5; \
done \
&& python -m pip install --no-cache-dir --upgrade pip build
&& python -m pip install --no-cache-dir --upgrade pip setuptools build wheel cmake setuptools_rust maturin
# Configure Rust environment for building Rust-backed Python wheels (tiktoken, etc.)
ENV CARGO_HOME=/root/.cargo
ENV PATH=/root/.cargo/bin:$PATH
# Allow forward-compatible ABI for PyO3-based packages on Python 3.14
ENV PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
rustup default stable
# Cache Python dependencies
COPY requirements.txt .