diff --git a/docker/base-images/base-admin-tools.Dockerfile b/docker/base-images/base-admin-tools.Dockerfile index ac32c9f6..db803e75 100644 --- a/docker/base-images/base-admin-tools.Dockerfile +++ b/docker/base-images/base-admin-tools.Dockerfile @@ -2,14 +2,31 @@ ARG BASE_IMAGE=alpine:3.20 FROM ${BASE_IMAGE} AS builder +# Alpine v3.20 comes with Python 3.12. But cqlsh won't work with Python 3.12 until the following issue is resolved. +# https://issues.apache.org/jira/browse/CASSANDRA-19206 +# Compiling Python 3.11.9 from source and installing it on the side. Then creating a venv using that python version. +# Revert this change once the issue mentioned above is resolved. RUN apk add --update --no-cache \ - py3-pip \ - python3-dev \ musl-dev \ libffi-dev \ - gcc - -RUN python3 -m venv /opt/venv + gcc \ + make \ + zlib-dev \ + openssl-dev + +RUN mkdir -p /opt/python/3.11.9 ; \ + cd /opt/python/3.11.9/ ; \ + wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz -P . ; \ + tar zxvf Python-3.11.9.tgz ; \ + cd Python-3.11.9 ; \ + ./configure --prefix=/opt/python/3.11.9; \ + make ; \ + make install ; \ + make clean ; \ + cd .. ; \ + rm -rf Python-3.11.9* + +RUN cd /opt/python/3.11.9/bin ; ./python3 -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" RUN pip3 install cqlsh @@ -28,6 +45,7 @@ RUN apk add --update --no-cache \ expat \ tini +COPY --from=builder /opt/python/3.11.9 /opt/python/3.11.9 COPY --from=builder /opt/venv /opt/venv ENV PATH="/opt/venv/bin:$PATH"