Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Python 3.11.9 on base-admin-tools so cqlsh can run #233

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions docker/base-images/base-admin-tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Comment on lines +25 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could technically skip the cleanup since this is all in the build container but not critical either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, added this just because I'm copying the parent folder to the other image.


RUN cd /opt/python/3.11.9/bin ; ./python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install cqlsh

Expand All @@ -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"
Expand Down
Loading