Skip to content

Commit 9eed782

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

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

Dockerfile

Lines changed: 11 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,11 @@ 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+
}
501+
496502
function apt_clean() {
497503
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
498504
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -508,6 +514,7 @@ else
508514
install_debian_dev_dependencies
509515
install_python
510516
install_additional_dev_dependencies
517+
install_rustup
511518
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
512519
install_golang
513520
fi
@@ -1834,6 +1841,10 @@ ENV DEV_APT_DEPS=${DEV_APT_DEPS} \
18341841

18351842
ARG PYTHON_LTO
18361843

1844+
ENV RUSTUP_HOME="/usr/local/rustup"
1845+
ENV CARGO_HOME="/usr/local/cargo"
1846+
ENV PATH="${CARGO_HOME}/bin:${PATH}"
1847+
18371848
COPY --from=scripts install_os_dependencies.sh /scripts/docker/
18381849
RUN PYTHON_LTO=${PYTHON_LTO} bash /scripts/docker/install_os_dependencies.sh dev
18391850

Dockerfile.ci

Lines changed: 11 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,11 @@ 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+
}
441+
436442
function apt_clean() {
437443
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
438444
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -448,6 +454,7 @@ else
448454
install_debian_dev_dependencies
449455
install_python
450456
install_additional_dev_dependencies
457+
install_rustup
451458
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
452459
install_golang
453460
fi
@@ -1628,6 +1635,9 @@ ENV DEV_APT_COMMAND=${DEV_APT_COMMAND} \
16281635
ARG AIRFLOW_PYTHON_VERSION="3.12.13"
16291636
ENV AIRFLOW_PYTHON_VERSION=${AIRFLOW_PYTHON_VERSION}
16301637
ENV GOLANG_MAJOR_MINOR_VERSION="1.26.1"
1638+
ENV RUSTUP_HOME="/usr/local/rustup"
1639+
ENV CARGO_HOME="/usr/local/cargo"
1640+
ENV PATH="${CARGO_HOME}/bin:${PATH}"
16311641

16321642
ARG PYTHON_LTO
16331643

@@ -1787,7 +1797,7 @@ ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
17871797
AIRFLOW_PREK_VERSION=${AIRFLOW_PREK_VERSION}
17881798

17891799
# 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}"
1800+
ENV PATH="/usr/python/bin:/root/.local/bin:${PATH}"
17911801
# Useful for creating a cache id based on the underlying architecture, preventing the use of cached python packages from
17921802
# an incorrect architecture.
17931803
ARG TARGETARCH

scripts/docker/install_os_dependencies.sh

Lines changed: 7 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,11 @@ 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+
}
407+
402408
function apt_clean() {
403409
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false
404410
rm -rf /var/lib/apt/lists/* /var/log/*
@@ -414,6 +420,7 @@ else
414420
install_debian_dev_dependencies
415421
install_python
416422
install_additional_dev_dependencies
423+
install_rustup
417424
if [[ "${INSTALLATION_TYPE}" == "CI" ]]; then
418425
install_golang
419426
fi

0 commit comments

Comments
 (0)