Skip to content

Commit ec364de

Browse files
s373nZShahanaFarooqui
authored andcommitted
build: Upgrade Docker base images to Debian Bookworm.
Undertaken to upgrade QEMU to 7.2. Also upgrades Python to 3.11 implicitly and migrates Python dependency management to virtual environments. Changelog-Changed: Released Docker images are now based on Debian Bookworm
1 parent 4329a19 commit ec364de

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

Dockerfile

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# * final: Creates the runtime image.
88

99
ARG DEFAULT_TARGETPLATFORM="linux/amd64"
10-
ARG BASE_DISTRO="debian:bullseye-slim"
10+
ARG BASE_DISTRO="debian:bookworm-slim"
1111

1212
FROM --platform=$BUILDPLATFORM ${BASE_DISTRO} AS base-downloader
1313
RUN set -ex \
@@ -76,7 +76,7 @@ RUN apt-get update -qq && \
7676
pkg-config \
7777
libssl-dev \
7878
protobuf-compiler \
79-
python3.9 \
79+
python3 \
8080
python3-dev \
8181
python3-mako \
8282
python3-pip \
@@ -89,13 +89,13 @@ RUN apt-get update -qq && \
8989
unzip \
9090
tclsh
9191

92-
ENV PATH="/root/.local/bin:$PATH"
93-
ENV PYTHON_VERSION=3 \
94-
PIP_BREAK_SYSTEM_PACKAGES=1
92+
ENV PATH="/root/.local/bin:$PATH" \
93+
PYTHON_VERSION=3
9594
RUN curl -sSL https://install.python-poetry.org | python3 -
96-
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
97-
RUN pip3 install --upgrade pip setuptools wheel
98-
RUN poetry self add poetry-plugin-export
95+
RUN mkdir -p /root/.venvs && \
96+
python3 -m venv /root/.venvs/cln && \
97+
. /root/.venvs/cln/bin/activate && \
98+
pip3 install --upgrade pip setuptools wheel
9999

100100
RUN wget -q https://zlib.net/fossils/zlib-1.2.13.tar.gz -O zlib.tar.gz && \
101101
wget -q https://www.sqlite.org/2019/sqlite-src-3290000.zip -O sqlite.zip && \
@@ -108,7 +108,11 @@ RUN git clone --recursive /tmp/lightning . && \
108108

109109
# Do not build python plugins (clnrest & wss-proxy) here, python doesn't support cross compilation.
110110
RUN sed -i '/^clnrest\|^wss-proxy/d' pyproject.toml && poetry export -o requirements.txt --without-hashes
111-
RUN pip3 install -r requirements.txt && pip3 cache purge
111+
RUN mkdir -p /root/.venvs && \
112+
python3 -m venv /root/.venvs/cln && \
113+
. /root/.venvs/cln/bin/activate && \
114+
pip3 install -r requirements.txt && \
115+
pip3 cache purge
112116
WORKDIR /
113117

114118
FROM base-builder AS base-builder-linux-amd64
@@ -257,21 +261,24 @@ RUN apt-get update -qq && \
257261
build-essential \
258262
libffi-dev \
259263
libssl-dev \
260-
python3.9 \
264+
python3 \
261265
python3-dev \
262-
python3-pip && \
266+
python3-pip \
267+
python3-venv && \
263268
apt-get clean && \
264269
rm -rf /var/lib/apt/lists/*
265270

266-
ENV PYTHON_VERSION=3 \
267-
PIP_BREAK_SYSTEM_PACKAGES=1
268-
RUN pip3 install --upgrade pip setuptools wheel
271+
ENV PYTHON_VERSION=3
272+
RUN mkdir -p /root/.venvs && \
273+
python3 -m venv /root/.venvs/cln && \
274+
. /root/.venvs/cln/bin/activate && \
275+
pip3 install --upgrade pip setuptools wheel
269276

270277
# Copy rustup_install_opts.txt file from builder
271278
COPY --from=builder /tmp/rustup_install_opts.txt /tmp/rustup_install_opts.txt
272279
# Setup ENV $RUSTUP_INSTALL_OPTS for this stage
273280
RUN export $(cat /tmp/rustup_install_opts.txt)
274-
ENV PATH="/root/.cargo/bin:$PATH"
281+
ENV PATH="/root/.cargo/bin:/root/.venvs/cln/bin:$PATH"
275282
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS}
276283

277284
WORKDIR /opt/lightningd/plugins/clnrest
@@ -315,7 +322,7 @@ RUN --mount=type=bind,from=builder,source=/var/libpq,target=/var/libpq,rw \
315322
ldconfig
316323

317324
COPY --from=builder /tmp/lightning_install/ /usr/local/
318-
COPY --from=builder-python /usr/local/lib/python3.9/dist-packages/ /usr/local/lib/python3.9/dist-packages/
325+
COPY --from=builder-python /root/.venvs/cln/lib/python3.11/site-packages /usr/local/lib/python3.11/dist-packages/
319326
COPY --from=downloader /opt/bitcoin/bin /usr/bin
320327
COPY --from=downloader /opt/litecoin/bin /usr/bin
321328
COPY tools/docker-entrypoint.sh entrypoint.sh

0 commit comments

Comments
 (0)