@@ -8,13 +8,20 @@ FROM $base AS builder
88
99ENV DEBIAN_FRONTEND=noninteractive
1010
11- # Install build dependencies for Python
12- RUN apt-get update && apt-get install -y \
13- build-essential \
14- git \
15- libffi-dev \
16- libssl-dev \
17- zlib1g-dev
11+ # Add deb-src URI sources for Python build dependence discovery
12+ RUN echo "deb-src http://archive.ubuntu.com/ubuntu/ jammy main" >> /etc/apt/sources.list && \
13+ apt-get update
14+
15+ # Install required build dependencies for Python
16+ RUN apt-get build-dep python3
17+
18+ # Install dependencies for all optional modules
19+ # See https://devguide.python.org/getting-started/setup-building/index.html#install-dependencies
20+ RUN apt-get install -y \
21+ build-essential gdb lcov pkg-config \
22+ libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
23+ libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
24+ lzma lzma-dev tk-dev uuid-dev zlib1g-dev libmpdec-dev libzstd-dev
1825
1926# Clone CPython repository at the 3.13 branch
2027RUN git clone --depth 1 --branch 3.13 https://github.com/python/cpython.git /tmp/cpython
@@ -32,15 +39,17 @@ RUN ./configure \
3239RUN make -j$(nproc)
3340RUN make install
3441
35- # Clean up temp files
42+
43+ # Reset the working directory and clean up
44+ WORKDIR /
3645RUN rm -rf /tmp/cpython
3746
3847# Set the PATH to include custom Python build
3948ENV PATH="/opt/python3/bin:${PATH}"
4049
4150# Install some Python runtime dependencies
42- RUN apt-get update && apt-get install -y \
43- libnuma-dev && \
51+ RUN apt-get install -y \
52+ libnuma-dev && \
4453 rm -rf /var/lib/apt/lists/*
4554
4655RUN python3 -m pip install --upgrade pip && \
0 commit comments