Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from Orange-OpenSource/openjdk
Browse files Browse the repository at this point in the history
Add a fix to make OpenJDK works with setcap on java
  • Loading branch information
Sébastien Allamand authored Jun 5, 2019
2 parents 75cf643 + 47fe680 commit 93763b6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
90 changes: 47 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ ARG CQLSH_CONTAINER
ARG http_proxy
ARG https_proxy


LABEL \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.dockerfile="/Dockerfile" \
Expand Down Expand Up @@ -53,53 +52,59 @@ ENV \

COPY files /

RUN set -ex \
&& echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
&& export CASSANDRA_VERSION=${CASSANDRA_VERSION:-$CASSANDRA_RELEASE} \
&& export CASSANDRA_HOME=/usr/local/apache-cassandra-${CASSANDRA_VERSION} \
&& apt-get update && apt-get -qq -y install --no-install-recommends \
bash \
RUN set -ex; \
\
# this is temporary waiting for this MR to be accepted https://github.com/docker-library/official-images/pull/6028;
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472;
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
ldconfig; \
\
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections; \
export CASSANDRA_VERSION=${CASSANDRA_VERSION:-$CASSANDRA_RELEASE}; \
export CASSANDRA_HOME=/usr/local/apache-cassandra-${CASSANDRA_VERSION}; \
apt-get update && apt-get -qq -y install --no-install-recommends \
libjemalloc1 \
localepurge \
wget \
jq \
&& wget -q -O - "http://search.maven.org/remotecontent?filepath=io/prometheus/jmx/jmx_prometheus_javaagent/${PROMETHEUS_VERSION}/jmx_prometheus_javaagent-${PROMETHEUS_VERSION}.jar" > /usr/local/share/prometheus-agent.jar \
&& wget -q -O - "http://search.maven.org/remotecontent?filepath=org/jolokia/jolokia-jvm/${JOLOKIA_VERSION}/jolokia-jvm-${JOLOKIA_VERSION}-agent.jar" > /usr/local/share/jolokia-agent.jar \
&& mirror_url=$( wget -q -O - 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred' ) \
&& wget -q -O - "${mirror_url}cassandra/${CASSANDRA_VERSION}/apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz" > /usr/local/apache-cassandra-bin.tar.gz \
&& tar -xzf /usr/local/apache-cassandra-bin.tar.gz -C /usr/local \
&& rm /usr/local/apache-cassandra-bin.tar.gz \
&& ln -s $CASSANDRA_HOME /usr/local/apache-cassandra \
&& wget -q -O - https://github.com/Yelp/dumb-init/releases/download/v${DI_VERSION}/dumb-init_${DI_VERSION}_amd64 > /sbin/dumb-init \
&& adduser --disabled-password --no-create-home --gecos '' --disabled-login cassandra \
&& mkdir -p /var/lib/cassandra/ /var/log/cassandra/ /etc/cassandra/triggers \
&& chmod +x /sbin/dumb-init /ready-probe.sh \
&& chown cassandra: /ready-probe.sh \
&& mv \
jq; \
wget -q -O - "http://search.maven.org/remotecontent?filepath=io/prometheus/jmx/jmx_prometheus_javaagent/${PROMETHEUS_VERSION}/jmx_prometheus_javaagent-${PROMETHEUS_VERSION}.jar" > /usr/local/share/prometheus-agent.jar; \
wget -q -O - "http://search.maven.org/remotecontent?filepath=org/jolokia/jolokia-jvm/${JOLOKIA_VERSION}/jolokia-jvm-${JOLOKIA_VERSION}-agent.jar" > /usr/local/share/jolokia-agent.jar; \
mirror_url=$( wget -q -O - 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred' ); \
wget -q -O - "${mirror_url}cassandra/${CASSANDRA_VERSION}/apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz" > /usr/local/apache-cassandra-bin.tar.gz; \
tar -xzf /usr/local/apache-cassandra-bin.tar.gz -C /usr/local; \
rm /usr/local/apache-cassandra-bin.tar.gz; \
ln -s $CASSANDRA_HOME /usr/local/apache-cassandra; \
wget -q -O - https://github.com/Yelp/dumb-init/releases/download/v${DI_VERSION}/dumb-init_${DI_VERSION}_amd64 > /sbin/dumb-init; \
adduser --disabled-password --no-create-home --gecos '' --disabled-login cassandra; \
mkdir -p /var/lib/cassandra/ /var/log/cassandra/ /etc/cassandra/triggers; \
chmod +x /sbin/dumb-init /ready-probe.sh; \
chown cassandra: /ready-probe.sh; \
mv \
/logback.xml \
/cassandra.yaml \
/jvm.options \
/prometheus.yaml \
/pre_stop.sh \
$CASSANDRA_CONF \
&& mv /usr/local/apache-cassandra/conf/cassandra-env.sh /etc/cassandra/ \
&& mkdir -p $CASSANDRA_DATA/data $CASSANDRA_LOGS \
&& ls -la $CASSANDRA_DATA $CASSANDRA_LOGS \
&& mkdir -p /files \
&& touch /files/file.log \
&& chown -R cassandra: /files $CASSANDRA_CONF $CASSANDRA_DATA $CASSANDRA_LOGS \
&& chmod 700 $CASSANDRA_DATA \
&& ls -la $CASSANDRA_DATA $CASSANDRA_LOGS \
&& chown cassandra: /run.sh \
&& if [ -n "$CQLSH_CONTAINER" ]; then apt-get -y --no-install-recommends install python; else rm -rf $CASSANDRA_HOME/pylib; fi \
&& apt-get update && apt-get -qq -y install \
$CASSANDRA_CONF; \
mv /usr/local/apache-cassandra/conf/cassandra-env.sh /etc/cassandra/; \
mkdir -p $CASSANDRA_DATA/data $CASSANDRA_LOGS; \
ls -la $CASSANDRA_DATA $CASSANDRA_LOGS; \
mkdir -p /files; \
touch /files/file.log; \
chown -R cassandra: /files $CASSANDRA_CONF $CASSANDRA_DATA $CASSANDRA_LOGS; \
chmod 700 $CASSANDRA_DATA; \
ls -la $CASSANDRA_DATA $CASSANDRA_LOGS; \
chown cassandra: /run.sh; \
mkdir -p /tmp chown cassandra /tmp; \
if [ -n "$CQLSH_CONTAINER" ]; then apt-get -y --no-install-recommends install python; else rm -rf $CASSANDRA_HOME/pylib; fi; \
apt-get update && apt-get -qq -y install \
libcap2-bin \
procps \
dnsutils \
&& apt-get -y purge wget jq localepurge \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf \
dnsutils; \
apt-get -y purge wget jq localepurge; \
apt-get -y autoremove; \
apt-get -y clean; \
rm -rf \
$CASSANDRA_HOME/*.txt \
$CASSANDRA_HOME/doc \
$CASSANDRA_HOME/javadoc \
Expand All @@ -121,11 +126,10 @@ RUN set -ex \
/usr/share/doc/ \
/usr/share/doc-base/ \
/usr/share/man/ \
/tmp/*

RUN setcap cap_ipc_lock=ep $(readlink -f $(which java))

RUN mkdir -p /tmp && chown cassandra /tmp
/tmp/*; \
\
setcap cap_ipc_lock=ep $(readlink -f $(which java)); \
setcap -v cap_ipc_lock=ep $(readlink -f $(which java))

VOLUME ["/var/lib/cassandra"]

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ params:
echo $(VERSION) $(JAVA_VERSION) $(CASSANDRA_VERSION)
echo $(TAG)

build:
build: params
docker build --pull --build-arg "CASSANDRA_VERSION=${CASSANDRA_VERSION}" \
--build-arg https_proxy=$(https_proxy) --build-arg http_proxy=$(http_proxy) \
-t ${PROJECT}:${TAG} .

build-cqlsh:
build-cqlsh: params
docker build --pull --build-arg "CASSANDRA_VERSION=${CASSANDRA_VERSION}" \
--build-arg="CQLSH_CONTAINER=1" \
--build-arg https_proxy=$(https_proxy) --build-arg http_proxy=$(http_proxy) \
Expand Down

0 comments on commit 93763b6

Please sign in to comment.