mirror of https://github.com/apache/cassandra
92 lines
4.7 KiB
Docker
92 lines
4.7 KiB
Docker
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
FROM debian:bullseye
|
|
LABEL org.opencontainers.image.authors="Apache Cassandra <dev@cassandra.apache.org>"
|
|
|
|
# CONTEXT is expected to be cassandra/.build
|
|
|
|
ENV DIST_DIR=/dist
|
|
ENV BUILD_HOME=/home/build
|
|
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
|
|
|
|
LABEL org.cassandra.buildenv=bullseye
|
|
|
|
RUN echo "Building with arguments:" \
|
|
&& echo " - DIST_DIR=${DIST_DIR}" \
|
|
&& echo " - BUILD_HOME=${BUILD_HOME}" \
|
|
&& echo " - CASSANDRA_DIR=${CASSANDRA_DIR}"
|
|
|
|
# configure apt to retry downloads
|
|
RUN echo 'APT::Acquire::Retries "99";' > /etc/apt/apt.conf.d/80-retries
|
|
RUN echo 'Acquire::http::Timeout "60";' > /etc/apt/apt.conf.d/80proxy.conf
|
|
RUN echo 'Acquire::ftp::Timeout "60";' >> /etc/apt/apt.conf.d/80proxy.conf
|
|
|
|
# install deps
|
|
RUN until apt-get update && apt-get -y install ant build-essential curl devscripts ed git sudo \
|
|
python3-pip rsync procps dh-python quilt bash-completion ; \
|
|
do echo "apt failed… trying again in 10s… " ; sleep 10 ; done
|
|
|
|
RUN until apt-get install -y --no-install-recommends openjdk-11-jdk openjdk-17-jdk; \
|
|
do echo "apt failed… trying again in 10s… " ; sleep 10 ; done
|
|
|
|
# Download and install OpenJDK 21.0.2 for the current architecture
|
|
RUN sh -c '\
|
|
JDK_OS=linux ;\
|
|
JDK_TAR="openjdk-21.0.2_${JDK_OS}-$(uname -m | sed "s/x86_64/x64/")_bin.tar.gz" ;\
|
|
JDK_VERSION_SHAS="08db1392a48d4eb5ea5315cf8f18b89dbaf36cda663ba882cf03c704c9257ec2 a2def047a73941e01a73739f92755f86b895811afb1f91243db214cff5bdac3f 8fd09e15dc406387a0aba70bf5d99692874e999bf9cd9208b452b5d76ac922d3 b3d588e16ec1e0ef9805d8a696591bd518a5cea62567da8f53b5ce32d11d22e4" ;\
|
|
curl -L --fail --silent --retry 2 --retry-delay 5 --max-time 3600 "https://download.java.net/java/GA/jdk21.0.2/f2283984656d49d69e91c558476027ac/13/GPL/${JDK_TAR}" -o $JDK_TAR ;\
|
|
JDK_SHA="$(sha256sum $JDK_TAR | cut -d" " -f2)" ;\
|
|
echo "$JDK_VERSION_SHAS" | sed "s/ /\n/g" | grep -q "$JDK_SHA" || { echo "SHA256 mismatch for $JDK_TAR $JDK_SHA"; exit 1; } ;\
|
|
mkdir -p /usr/lib/jvm/java-21-openjdk-$(dpkg --print-architecture) ;\
|
|
tar -C /usr/lib/jvm/java-21-openjdk-$(dpkg --print-architecture) --strip-components=1 -xzf $JDK_TAR ;\
|
|
rm $JDK_TAR'
|
|
|
|
# Add OpenJDK 21 to update-alternatives
|
|
RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-21-openjdk-$(dpkg --print-architecture)/bin/java 1
|
|
RUN update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-21-openjdk-$(dpkg --print-architecture)/bin/javac 1
|
|
|
|
RUN update-alternatives --set java /usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/bin/java
|
|
RUN update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-$(dpkg --print-architecture)/bin/javac
|
|
|
|
# python3 is needed for the gen-doc target
|
|
RUN pip install --upgrade pip
|
|
|
|
# dependencies for .build/ci/ci_parser.py
|
|
RUN pip install beautifulsoup4==4.12.3 jinja2==3.1.3
|
|
|
|
# install golang. GO_VERSION_SHA must be updated with VERSION
|
|
RUN sh -c '\
|
|
GO_VERSION="1.24.3" ;\
|
|
GO_VERSION_SHAS="3333f6ea53afa971e9078895eaa4ac7204a8c6b5c68c10e6bc9a33e8e391bdd8 a463cb59382bd7ae7d8f4c68846e73c4d589f223c589ac76871b66811ded7836 13e6fe3fcf65689d77d40e633de1e31c6febbdbcb846eb05fc2434ed2213e92b 64a3fa22142f627e78fac3018ce3d4aeace68b743eff0afda8aae0411df5e4fb" ;\
|
|
GO_OS=linux ;\
|
|
GO_TAR="go${GO_VERSION}.${GO_OS}-$(dpkg --print-architecture).tar.gz" ;\
|
|
curl -L --fail --silent --retry 2 --retry-delay 5 --max-time 3600 https://go.dev/dl/$GO_TAR -o $GO_TAR ;\
|
|
GO_SHA="$(sha256sum $GO_TAR | cut -d" " -f2)" ;\
|
|
echo "$GO_VERSION_SHAS" | sed "s/ /\n/g" | grep -q "$GO_SHA" || { echo "SHA256 mismatch for $GO_TAR $GO_SHA"; exit 1; } ;\
|
|
tar -C /usr/local -xzf $GO_TAR ;\
|
|
rm $GO_TAR'
|
|
|
|
ENV GOROOT="/usr/local/go"
|
|
ENV GOPATH="$BUILD_HOME/go"
|
|
ENV PATH="$PATH:/usr/local/go/bin"
|
|
|
|
# allow lower UIDs and GIDs
|
|
RUN sed -i 's/UID_MIN 1000/UID_MIN 100/' /etc/login.defs
|
|
RUN sed -i 's/UID_MIN 1000/UID_MIN 10/' /etc/login.defs
|
|
|
|
# suppress warnings about mismatching ownership
|
|
RUN git config --global --add safe.directory ${CASSANDRA_DIR} |