smiklosovic commented on code in PR #1996: URL: https://github.com/apache/cassandra/pull/1996#discussion_r1053260720
########## .build/docker/Dockerfile: ########## @@ -0,0 +1,136 @@ +# +# 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. +# +# Forked from https://github.com/docker-library/cassandra/blob/b3332696b4a6a4405ebf95a4c4065543ee1a073d/4.0/Dockerfile +# +# WARNING: This Dockerfile has no warranties, should be used only for Cassandra development purposes. +# +FROM eclipse-temurin:11-jre-focal + +ARG CASSANDRA_TARBALL + +# explicitly set user/group IDs +RUN set -eux; \ + groupadd -r cassandra --gid=999; \ + useradd -r -g cassandra --uid=999 cassandra + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ +# solves warning: "jemalloc shared library could not be preloaded to speed up memory allocations" + libjemalloc2 \ +# "free" is used by cassandra-env.sh + procps \ +# "cqlsh" needs a python interpreter + python3 \ +# "ip" is not required by Cassandra itself, but is commonly used in scripting Cassandra's configuration (since it is so fixated on explicit IP addresses) + iproute2 \ +# Cassandra will automatically use numactl if available +# https://github.com/apache/cassandra/blob/18bcda2d4c2eba7370a0b21f33eed37cb730bbb3/bin/cassandra#L90-L100 +# https://github.com/apache/cassandra/commit/604c0e87dc67fa65f6904ef9a98a029c9f2f865a + numactl \ +# required for docker health-check + netcat \ + ; \ + rm -rf /var/lib/apt/lists/*; \ +# https://issues.apache.org/jira/browse/CASSANDRA-15767 ("bin/cassandra" only looks for "libjemalloc.so" or "libjemalloc.so.1" which doesn't match our "libjemalloc.so.2") + libjemalloc="$(readlink -e /usr/lib/*/libjemalloc.so.2)"; \ + ln -sT "$libjemalloc" /usr/local/lib/libjemalloc.so; \ + ldconfig + +# grab gosu for easy step-down from root +# https://github.com/tianon/gosu/releases +ENV GOSU_VERSION 1.14 +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates dirmngr gnupg wget; \ + rm -rf /var/lib/apt/lists/*; \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + gpgconf --kill all; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + chmod +x /usr/local/bin/gosu; \ + gosu --version; \ + gosu nobody true +COPY $CASSANDRA_TARBALL cassandra-bin.tgz +ENV CASSANDRA_HOME /opt/cassandra +ENV CASSANDRA_CONF /etc/cassandra +ENV PATH $CASSANDRA_HOME/bin:$PATH + +RUN set -eux; \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends ca-certificates dirmngr gnupg wget; \ + rm -rf /var/lib/apt/lists/*; \ + \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + \ + mkdir -p "$CASSANDRA_HOME"; \ + tar --extract --file cassandra-bin.tgz --directory "$CASSANDRA_HOME" --strip-components 1; \ + rm cassandra-bin.tgz*; \ + \ + [ ! -e "$CASSANDRA_CONF" ]; \ + mv "$CASSANDRA_HOME/conf" "$CASSANDRA_CONF"; \ + ln -sT "$CASSANDRA_CONF" "$CASSANDRA_HOME/conf"; \ + \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "$dpkgArch" in \ + ppc64el) \ +# https://issues.apache.org/jira/browse/CASSANDRA-13345 +# "The stack size specified is too small, Specify at least 328k" + grep -- '^-Xss256k$' "$CASSANDRA_CONF/jvm-server.options"; \ + sed -ri 's/^-Xss256k$/-Xss512k/' "$CASSANDRA_CONF/jvm-server.options"; \ + grep -- '^-Xss512k$' "$CASSANDRA_CONF/jvm-server.options"; \ + ;; \ + esac; \ + \ + mkdir -p "$CASSANDRA_CONF" /var/lib/cassandra /var/log/cassandra; \ + chown -R cassandra:cassandra "$CASSANDRA_CONF" /var/lib/cassandra /var/log/cassandra; \ + chmod 777 "$CASSANDRA_CONF" /var/lib/cassandra /var/log/cassandra; \ + chmod -R a+rwX "$CASSANDRA_CONF"; \ + ln -sT /var/lib/cassandra "$CASSANDRA_HOME/data"; \ + ln -sT /var/log/cassandra "$CASSANDRA_HOME/logs"; \ + \ +# smoke test + cassandra -v + +VOLUME /var/lib/cassandra + +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +# 7000: intra-node communication +# 7001: TLS intra-node communication +# 7199: JMX +# 9042: CQL +# 9160: thrift service +EXPOSE 7000 7001 7199 9042 9160 + +# Container is healthy when JMX port is up +HEALTHCHECK CMD /usr/bin/nc localhost -z 7199 || exit 1 Review Comment: This might be replaced by nodetool status returning 0 exit code. The fact that this port is up does not necessarily mean that nodetool status will be successful as port is open but the node is still booting anyway under the hood. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

