Skip to content

Commit c38541c

Browse files
thavaahariharangit“Thavachelvam
and
“Thavachelvam
authored
Adding Cargo Rust to the Python Environment (#11599)
Co-authored-by: “Thavachelvam <“[email protected]”>
1 parent 92370ad commit c38541c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

python/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,24 @@ COPY --from=python-3.13 $PYENV_ROOT/versions/ $PYENV_ROOT/versions/
158158
COPY --from=python-3.13 /opt/python/ /opt/python/
159159

160160
RUN pyenv global $PY_3_13
161+
162+
USER root
163+
164+
# Install Rust
165+
ENV RUSTUP_HOME=/opt/rust \
166+
CARGO_HOME=/opt/rust \
167+
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse \
168+
PATH="${PATH}:/opt/rust/bin"
169+
RUN mkdir -p "$RUSTUP_HOME" && chown dependabot:dependabot "$RUSTUP_HOME"
170+
171+
USER dependabot
172+
173+
COPY --from=rust /usr/local/rustup $RUSTUP_HOME
174+
COPY --from=rust /usr/local/cargo $CARGO_HOME
175+
176+
# Configure cargo to use Git CLI so the Git shim works
177+
RUN mkdir -p ~/.cargo && printf "[net]\ngit-fetch-with-cli = true\n" >> ~/.cargo/config.toml
178+
179+
COPY --chown=dependabot:dependabot cargo $DEPENDABOT_HOME/cargo
180+
COPY --chown=dependabot:dependabot common $DEPENDABOT_HOME/common
181+
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater

0 commit comments

Comments
 (0)