File tree Expand file tree Collapse file tree 3 files changed +11
-21
lines changed
Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ ARG FROM_IMAGE=ubuntu:22.04
1010FROM $FROM_IMAGE AS ubuntu-base
1111FROM rocm/dev-ubuntu-22.04:${ROCM_VERSION}-complete AS sdk-base
1212
13+ ENV DEBIAN_FRONTEND=noninteractive
14+
1315COPY --from=ubuntu-base /opt /opt
1416ENV PATH="/opt/python3/bin:${PATH}"
1517
@@ -19,13 +21,13 @@ ARG OMPI_BRANCH="v5.0.x"
1921# Update and Install basic Linux development tools
2022RUN rm /etc/apt/sources.list.d/* \
2123 && apt-get update \
22- && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
24+ && apt-get install -y --no-install-recommends \
2325 dh-autoreconf git \
2426 ca-certificates ssh make libtinfo* initramfs-tools libelf-dev \
2527 wget build-essential autoconf automake libtool \
2628 pkg-config libnuma* gfortran flex hwloc cmake && \
2729 if [ ! -d "/opt/python3" ]; then \
28- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
30+ apt-get install -y --no-install-recommends \
2931 python3-venv python3-dev python3-pip; \
3032 else \
3133 echo "Using free-threaded Python build"; \
Original file line number Diff line number Diff line change @@ -16,18 +16,12 @@ ARG GROUP_ID=1000
1616
1717ENV PIP_USE_PEP517=1
1818
19- # If we are using a free-threaded base image, need to install libffi-dev again
20- ARG base
21- RUN case "$base" in *nogil) \
22- echo "Installing libffi-dev for free-threaded build"; \
23- apt-get update && apt-get install -y libffi-dev;; \
24- esac;
25-
2619# Install pip dependencies
2720RUN python3 -m venv /venv && \
2821 /venv/bin/pip install --no-cache-dir --upgrade pip wheel setuptools
2922# Jupyter cannot yet be installed with a free-threaded Python build
30- # See https://github.com/jupyterlab/jupyterlab/issues/16915#
23+ # See https://github.com/jupyterlab/jupyterlab/issues/16915
24+ ARG base
3125RUN case "$base" in *nogil) \
3226 echo "Skipping jupyter installation for free-threaded build";; \
3327 *) \
Original file line number Diff line number Diff line change 44
55ARG FROM_IMAGE=ubuntu:22.04
66
7- # Builder stage: build Python 3.13 from source with the GIL disabled
87FROM $FROM_IMAGE AS builder
98
10- ARG DEBIAN_FRONTEND=noninteractive
9+ ENV DEBIAN_FRONTEND=noninteractive
1110
1211# Install build dependencies for Python
1312RUN apt-get update && apt-get install -y \
@@ -18,22 +17,17 @@ RUN apt-get update && apt-get install -y \
1817 zlib1g-dev
1918
2019# Clone CPython repository at the 3.13 branch
21- RUN git clone --depth 1 --branch 3.13 https://github.com/python/cpython.git /usr/src /cpython
20+ RUN git clone --depth 1 --branch 3.13 https://github.com/python/cpython.git /tmp /cpython
2221
23- WORKDIR /usr/src /cpython
22+ WORKDIR /tmp /cpython
2423
2524# Configure, build, and install Python 3.13 with the GIL disabled
2625RUN ./configure --prefix=/opt/python3 --disable-gil --enable-optimizations
2726RUN make -j$(nproc)
2827RUN make install
2928
30- # Base runtime stage
31- FROM $FROM_IMAGE
32-
33- ARG DEBIAN_FRONTEND=noninteractive
34-
35- # Copy Python build from the previous stage
36- COPY --from=builder /opt/python3/ /opt/python3/
29+ # Clean up temp files
30+ RUN rm -rf /tmp/cpython
3731
3832# Set the PATH to include custom Python build
3933ENV PATH="/opt/python3/bin:${PATH}"
You can’t perform that action at this time.
0 commit comments