@@ -341,8 +341,8 @@ RUN uv pip install --system --no-cache \
341341 "tensorflow-io==0.37.*" \
342342 tensorflow-datasets
343343
344- # Install rust and cargo (required for some packages)
345- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
344+ # Install rust and cargo (required for some packages) - minimal install
345+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
346346ENV PATH="/root/.cargo/bin:${PATH}"
347347
348348# Install data science packages
@@ -357,17 +357,17 @@ RUN uv pip install --system --no-cache \
357357
358358# Install SageMaker packages
359359RUN uv pip install --system --no-cache \
360- sagemaker \
361- sagemaker-experiments==0.* \
362- sagemaker-tensorflow-training \
363- sagemaker-training \
360+ " sagemaker<3" \
361+ sagemaker-experiments==0.1.45 \
362+ sagemaker-tensorflow-training==20.4.1 \
363+ sagemaker-training==4.8.4 \
364364 y-py \
365- sagemaker-studio-analytics-extension \
366- "sparkmagic==0.23 .0" \
367- sagemaker-studio-sparkmagic-lib \
365+ sagemaker-studio-analytics-extension==0.1.4 \
366+ "sparkmagic==0.21 .0" \
367+ sagemaker-studio-sparkmagic-lib==0.2.0 \
368368 smclarify
369369
370- # install boost
370+ # install boost (headers only - skip full compilation to save space)
371371# tensorflow is compiled with --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"
372372RUN wget https://sourceforge.net/projects/boost/files/boost/1.82.0/boost_1_82_0.tar.gz/download -O boost_1_82_0.tar.gz \
373373 && tar -xzf boost_1_82_0.tar.gz \
@@ -377,6 +377,7 @@ RUN wget https://sourceforge.net/projects/boost/files/boost/1.82.0/boost_1_82_0.
377377 && cd .. \
378378 && rm -rf boost_1_82_0.tar.gz \
379379 && rm -rf boost_1_82_0 \
380+ && rm -rf /usr/lib/libboost_*.a \
380381 && cd /usr/include/boost
381382
382383# Add NGC vars
@@ -390,7 +391,35 @@ RUN rm -rf /usr/local/share/jupyter/kernels/python3/kernel.json
390391
391392# Clean up JupyterLab staging and test directories to reduce image size
392393RUN rm -rf /usr/local/lib/python*/site-packages/jupyterlab/staging \
393- && rm -rf /usr/local/lib/python*/site-packages/jupyterlab/tests
394+ && rm -rf /usr/local/lib/python*/site-packages/jupyterlab/tests \
395+ && rm -rf /usr/local/share/jupyter/lab/staging \
396+ && rm -rf /root/.cache \
397+ && rm -rf /root/.local \
398+ && rm -rf /var/cache/* \
399+ && rm -rf /root/.cargo/registry \
400+ && rm -rf /root/.cargo/git \
401+ && rm -rf /root/.rustup/toolchains/*/share/doc \
402+ && rm -rf /root/.rustup/toolchains/*/share/man \
403+ && rm -rf /root/.rustup/tmp \
404+ && rm -rf /usr/local/cuda/extras \
405+ && rm -rf /usr/local/cuda/nsight* \
406+ && rm -rf /usr/local/cuda/compute-sanitizer \
407+ && rm -rf /usr/local/cuda/libnvvp \
408+ && rm -rf /usr/share/doc/* \
409+ && rm -rf /usr/share/man/* \
410+ && rm -rf /usr/share/info/* \
411+ && rm -rf /var/log/* \
412+ && find /usr/local/lib/python*/site-packages -name "*.pyc" -delete \
413+ && find /usr/local/lib/python*/site-packages -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true \
414+ && find /usr/local/lib/python*/site-packages -name "tests" -type d -exec rm -rf {} + 2>/dev/null || true \
415+ && find /usr/local/lib/python*/site-packages -name "test" -type d -exec rm -rf {} + 2>/dev/null || true \
416+ && find /usr/local/lib/python*/site-packages -name "*.pyx" -delete \
417+ && find /usr/local/lib/python*/site-packages -name "*.c" -delete \
418+ && find /usr/local/lib/python*/site-packages -name "*.h" -delete \
419+ && find /usr/local -name "*.a" -delete \
420+ && find /usr/local/lib/python*/site-packages -type d -name "docs" -exec rm -rf {} + 2>/dev/null || true \
421+ && find /usr/local/lib/python*/site-packages -type d -name "doc" -exec rm -rf {} + 2>/dev/null || true \
422+ && find /usr/local/lib/python*/site-packages -type d -name "examples" -exec rm -rf {} + 2>/dev/null || true
394423
395424# remove tmp files
396425RUN rm -rf /tmp/*
0 commit comments