Skip to content

Commit 4dbceaf

Browse files
committed
Install rustup and cargo in CI and prod build images
1 parent f4713de commit 4dbceaf

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ fi
122122
AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18}
123123
PYTHON_LTO=${PYTHON_LTO:-true}
124124
GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4}
125+
RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable}
125126
COSIGN_VERSION=${COSIGN_VERSION:-3.0.5}
126127

127128
if [[ "${1}" == "runtime" ]]; then
@@ -493,6 +494,14 @@ function install_golang() {
493494
rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz
494495
}
495496

497+
function install_rustup() {
498+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
499+
sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}"
500+
# Make rustup and cargo available system-wide
501+
mv /root/.cargo /usr/local/cargo
502+
mv /root/.rustup /usr/local/rustup
503+
}
504+
496505
function apt_clean() {
497506
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
498507
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -508,6 +517,7 @@ else
508517
install_debian_dev_dependencies
509518
install_python
510519
install_additional_dev_dependencies
520+
install_rustup
511521
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
512522
install_golang
513523
fi
@@ -1834,6 +1844,10 @@ ENV DEV_APT_DEPS=${DEV_APT_DEPS} \
18341844

18351845
ARG PYTHON_LTO
18361846

1847+
ENV RUSTUP_HOME="/usr/local/rustup"
1848+
ENV CARGO_HOME="/usr/local/cargo"
1849+
ENV PATH="${CARGO_HOME}/bin:${PATH}"
1850+
18371851
COPY --from=scripts install_os_dependencies.sh /scripts/docker/
18381852
RUN PYTHON_LTO=${PYTHON_LTO} bash /scripts/docker/install_os_dependencies.sh dev
18391853

Dockerfile.ci

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fi
6262
AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18}
6363
PYTHON_LTO=${PYTHON_LTO:-true}
6464
GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4}
65+
RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable}
6566
COSIGN_VERSION=${COSIGN_VERSION:-3.0.5}
6667

6768
if [[ "${1}" == "runtime" ]]; then
@@ -433,6 +434,14 @@ function install_golang() {
433434
rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz
434435
}
435436

437+
function install_rustup() {
438+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
439+
sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}"
440+
# Make rustup and cargo available system-wide
441+
mv /root/.cargo /usr/local/cargo
442+
mv /root/.rustup /usr/local/rustup
443+
}
444+
436445
function apt_clean() {
437446
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
438447
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -448,6 +457,7 @@ else
448457
install_debian_dev_dependencies
449458
install_python
450459
install_additional_dev_dependencies
460+
install_rustup
451461
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
452462
install_golang
453463
fi
@@ -1628,6 +1638,9 @@ ENV DEV_APT_COMMAND=${DEV_APT_COMMAND} \
16281638
ARG AIRFLOW_PYTHON_VERSION="3.12.13"
16291639
ENV AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION}
16301640
ENV GOLANG_MAJOR_MINOR_VERSION="1.26.1"
1641+
ENV RUSTUP_HOME="/usr/local/rustup"
1642+
ENV CARGO_HOME="/usr/local/cargo"
1643+
ENV PATH="${CARGO_HOME}/bin:${PATH}"
16311644

16321645
ARG PYTHON_LTO
16331646

@@ -1787,7 +1800,7 @@ ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
17871800
AIRFLOW_PREK_VERSION=${AIRFLOW_PREK_VERSION}
17881801

17891802
# The PATH is needed for python to find installed and cargo to build the wheels
1790-
ENV PATH="/usr/python/bin:/root/.local/bin:/root/.cargo/bin:${PATH}"
1803+
ENV PATH="/usr/python/bin:/root/.local/bin:${PATH}"
17911804
# Useful for creating a cache id based on the underlying architecture, preventing the use of cached python packages from
17921805
# an incorrect architecture.
17931806
ARG TARGETARCH

scripts/docker/install_os_dependencies.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fi
2828
AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION:-3.10.18}
2929
PYTHON_LTO=${PYTHON_LTO:-true}
3030
GOLANG_MAJOR_MINOR_VERSION=${GOLANG_MAJOR_MINOR_VERSION:-1.24.4}
31+
RUSTUP_DEFAULT_TOOLCHAIN=${RUSTUP_DEFAULT_TOOLCHAIN:-stable}
3132
COSIGN_VERSION=${COSIGN_VERSION:-3.0.5}
3233

3334
if [[ "${1}" == "runtime" ]]; then
@@ -399,6 +400,14 @@ function install_golang() {
399400
rm -rf /usr/local/go && tar -C /usr/local -xzf go"${GOLANG_MAJOR_MINOR_VERSION}".linux.tar.gz
400401
}
401402

403+
function install_rustup() {
404+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
405+
sh -s -- -y --default-toolchain "${RUSTUP_DEFAULT_TOOLCHAIN}"
406+
# Make rustup and cargo available system-wide
407+
mv /root/.cargo /usr/local/cargo
408+
mv /root/.rustup /usr/local/rustup
409+
}
410+
402411
function apt_clean() {
403412
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
404413
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -414,6 +423,7 @@ else
414423
install_debian_dev_dependencies
415424
install_python
416425
install_additional_dev_dependencies
426+
install_rustup
417427
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
418428
install_golang
419429
fi

0 commit comments

Comments
 (0)