cassandra/.build/docker/bullseye-build.docker

79 lines
3.5 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=debian_build
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 update \
&& apt-get install -y --no-install-recommends openjdk-11-jdk openjdk-17-jdk ; \
do echo "apt failed… trying again in 10s… " ; sleep 10 ; done
RUN update-java-alternatives --set java-1.11.0-openjdk-$(dpkg --print-architecture)
# 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 ;\
[ $(uname) = "Darwin" ] && GO_OS=darwin ;\
GO_PLATFORM=amd64 ;\
[ $(uname -m) = "aarch64" ] && GO_PLATFORM=arm64 ;\
GO_TAR="go${GO_VERSION}.${GO_OS}-${GO_PLATFORM}.tar.gz" ;\
curl -L --fail --silent --retry 2 --retry-delay 5 --max-time 30 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"
# Prepopulate Maven repository with dependencies from all branches. see _create_user.sh
COPY docker/_prepopulate_maven_deps.sh /tmp/_prepopulate_maven_deps.sh
RUN mkdir -p /home/image-cache && chmod -R a+rwx /home/image-cache
RUN bash /tmp/_prepopulate_maven_deps.sh /home/image-cache/.m2/repository && rm /tmp/_prepopulate_maven_deps.sh
RUN cp -a /root/.gradle /home/image-cache/.gradle