1010# See the License for the specific language governing permissions and
1111# limitations under the License.
1212
13- FROM ubuntu:20 .04
14- MAINTAINER Apache Cassandra <dev@cassandra.apache.org>
13+ FROM ubuntu:22 .04
14+ LABEL org.opencontainers.image.authors=" Apache Cassandra <dev@cassandra.apache.org>"
1515
1616# CONTEXT is expected to be cassandra/.build
1717
@@ -23,7 +23,7 @@ ENV LC_CTYPE=en_US.UTF-8
2323ENV PYTHONIOENCODING=utf-8
2424ENV PYTHONUNBUFFERED=true
2525
26- LABEL org.cassandra.buildenv=ubuntu_2004
26+ LABEL org.cassandra.buildenv=ubuntu_test
2727
2828RUN echo "Building with arguments:" \
2929 && echo " - DIST_DIR=${DIST_DIR}" \
@@ -42,7 +42,7 @@ RUN echo 'Acquire::ftp::Timeout "60";' >> /etc/apt/apt.conf.d/80proxy.conf
4242
4343RUN export DEBIAN_FRONTEND=noninteractive && \
4444 apt-get update && \
45- apt-get install -y --no-install-recommends software-properties-common apt-utils
45+ apt-get install -y --no-install-recommends software-properties-common apt-utils gnupg
4646
4747RUN export DEBIAN_FRONTEND=noninteractive && \
4848 add-apt-repository -y ppa:deadsnakes/ppa && \
@@ -54,7 +54,8 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
5454 vim lsof sudo libjemalloc2 dumb-init locales rsync \
5555 openjdk-8-jdk openjdk-11-jdk openjdk-17-jdk ant ant-optional
5656
57-
57+ RUN update-alternatives --remove java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/jre/bin/java
58+ RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin/java 1081
5859RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
5960RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 3
6061RUN python3.8 -m pip install --upgrade pip
@@ -79,6 +80,7 @@ RUN find /etc -type f -name java.security -exec sed -i 's/TLSv1, TLSv1.1//' {} \
7980RUN find /etc -type f -name java.security -exec sed -i 's/3DES_EDE_CBC$/3DES_EDE_CBC, TLSv1, TLSv1.1/' {} \;
8081
8182# create and change to cassandra-tmp user, use an rare uid to avoid collision later on
83+ RUN mkdir -p /home/image-cache && chmod -R a+rwx /home/image-cache
8284RUN adduser --disabled-login --uid 901743 --lastuid 901743 --gecos cassandra cassandra-tmp
8385RUN gpasswd -a cassandra-tmp sudo
8486RUN echo "cassandra-tmp ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build
@@ -87,11 +89,16 @@ RUN chmod 0440 /etc/sudoers.d/build
8789# switch to the cassandra user
8890RUN mkdir -p ${BUILD_HOME} && chmod a+rwx ${BUILD_HOME}
8991USER cassandra-tmp
90- ENV HOME ${BUILD_HOME}
92+ ENV HOME= ${BUILD_HOME}
9193WORKDIR ${BUILD_HOME}
9294
9395ENV ANT_HOME=/usr/share/ant
9496
97+ # Prepopulate Maven repository with dependencies from all branches. see _create_user.sh
98+ COPY docker/_prepopulate_maven_deps.sh /tmp/_prepopulate_maven_deps.sh
99+ RUN bash /tmp/_prepopulate_maven_deps.sh /home/image-cache/.m2/repository
100+ RUN cp -a /home/cassandra-tmp/.gradle /home/image-cache/.gradle
101+
95102# run pip commands and setup virtualenv (note we do this after we switch to cassandra user so we
96103# setup the virtualenv for the cassandra user and not the root user by accident) for Python 3.8/3.11
97104# Don't build cython extensions when installing cassandra-driver. During test execution the driver
@@ -110,15 +117,22 @@ RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \
110117 && pip3 install -r /opt/requirements.txt \
111118 && pip3 freeze --user"
112119
113- RUN virtualenv --python= python3.11 ${BUILD_HOME}/env3.11
120+ RUN python3.11 -m venv ${BUILD_HOME}/env3.11
114121RUN chmod +x ${BUILD_HOME}/env3.11/bin/activate
115122
116123RUN /bin/bash -c "export CASS_DRIVER_NO_CYTHON=1 CASS_DRIVER_NO_EXTENSIONS=1 \
117124 && source ${BUILD_HOME}/env3.11/bin/activate \
118125 && curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
119- && pip3 install -r /opt/requirements.txt \
126+ && pip3 install --upgrade \"pip<25.0\" \"setuptools==60.8.2\" wheel \
127+ && pip3 install --no-build-isolation -r /opt/requirements.txt \
120128 && pip3 freeze --user"
121129
130+ # 4* requires java8, sudo doesn't work on cross-platform builds
131+ USER root
132+ RUN update-alternatives --set java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin/java
133+ RUN update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin/javac
134+ USER cassandra-tmp
135+
122136# Initialize the CCM git repo as well as this also can fail to clone
123137RUN /bin/bash -c "source ${BUILD_HOME}/env3.8/bin/activate && \
124138 ccm create -n 1 -v git:cassandra-4.1 test && ccm remove test && \
@@ -131,16 +145,23 @@ RUN bash -c 'source ${BUILD_HOME}/env3.8/bin/activate && \
131145 latest_4_1=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")4\.1\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \
132146 for i in $(seq 1 $latest_4_1); do echo $i ; ccm create --quiet -n 1 -v binary:4.1.$i test && ccm remove test ; done'
133147
134- # 5+ requires java11
135- RUN sudo update-java-alternatives --set java-1.11.0-openjdk-$(dpkg --print-architecture)
148+ # 5+ requires java11, sudo doesn't work on cross-platform builds
149+ USER root
150+ RUN update-alternatives --set java /usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/bin/java
151+ RUN update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/bin/javac
152+ USER cassandra-tmp
136153
137154# Initialize ccm versions. branch heads and all versions iterating through to the latest version found on downloads.apache.org/cassandra
138155RUN rm -fr ${BUILD_HOME}/.ccm/repository/_git_cache_apache
139156RUN /bin/bash -c 'source ${BUILD_HOME}/env3.8/bin/activate && \
140157 ccm create --quiet -n 1 -v git:cassandra-5.0 test && ccm remove test && \
158+ ccm create --quiet -n 1 -v git:cassandra-6.0 test && ccm remove test && \
141159 ccm create --quiet -n 1 -v git:trunk test && ccm remove test && \
142160 latest_5_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")5\.0\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \
143161 for i in $(seq 1 $latest_5_0); do echo $i ; ccm create --quiet -n 1 -v binary:5.0.$i test && ccm remove test ; done'
162+ # TODO uncomment when 6.0.0 is released
163+ #latest_6_0=$(curl -s https://downloads.apache.org/cassandra/ | grep -oP "(?<=href=\")6\.0\.[0-9]+(?=\")" | sort -V | tail -1 | cut -d"." -f3) && \
164+ #for i in $(seq 1 $latest_6_0); do echo $i ; ccm create --quiet -n 1 -v binary:6.0.$i test && ccm remove test ; done'
144165
145166# the .git subdirectories to pip installed cassandra-driver breaks virtualenv-clone, so just remove them
146167# and other directories we don't need in image
0 commit comments