Skip to content

Commit 0178153

Browse files
committed
Tweaking so that we do not have to run with build-args
1 parent fdbc8f7 commit 0178153

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

Dockerfile

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,37 @@ LABEL \
2929
org.label-schema.vcs-type="Git" \
3030
org.label-schema.vcs-url="https://github.com/k8s-for-greeks/docker-cassandra-k8s"
3131

32-
ENV CASSANDRA_HOME=/usr/local/apache-cassandra-${CASSANDRA_VERSION} \
32+
ENV \
3333
CASSANDRA_CONF=/etc/cassandra \
3434
CASSANDRA_DATA=/cassandra_data \
3535
CASSANDRA_LOGS=/var/log/cassandra \
36+
CASSANDRA_RELEASE=3.9 \
3637
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 \
37-
PATH=${PATH}:/usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/local/apache-cassandra-${CASSANDRA_VERSION}/bin \
3838
DI_VERSION=1.2.0 \
3939
DI_SHA=81231da1cd074fdc81af62789fead8641ef3f24b6b07366a1c34e5b059faf363
4040

41-
ADD files /
41+
COPY files /
4242

43-
RUN set -e && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
44-
&& apt-get update && apt-get -qq -y --force-yes install --no-install-recommends \
43+
RUN \
44+
set -ex \
45+
&& echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
46+
&& export CASSANDRA_VERSION=${CASSANDRA_VERSION:-$CASSANDRA_RELEASE} \
47+
&& export CASSANDRA_HOME=/usr/local/apache-cassandra-${CASSANDRA_VERSION} \
48+
&& apt-get update && apt-get -qq -y --force-yes install --no-install-recommends \
4549
openjdk-8-jre-headless \
4650
libjemalloc1 \
4751
localepurge \
48-
wget && \
49-
mirror_url=$( wget -q -O - http://www.apache.org/dyn/closer.cgi/cassandra/ \
52+
wget \
53+
&& mirror_url=$( wget -q -O - http://www.apache.org/dyn/closer.cgi/cassandra \
5054
| sed -n 's#.*href="\(http://ftp.[^"]*\)".*#\1#p' \
5155
| head -n 1 \
52-
) \
56+
) \
5357
&& wget -q -O - ${mirror_url}/${CASSANDRA_VERSION}/apache-cassandra-${CASSANDRA_VERSION}-bin.tar.gz \
5458
| tar -xzf - -C /usr/local \
59+
&& ln -s $CASSANDRA_HOME /usr/local/apache-cassandra \
5560
&& wget -q -O - https://github.com/Yelp/dumb-init/releases/download/v${DI_VERSION}/dumb-init_${DI_VERSION}_amd64 > /sbin/dumb-init \
5661
&& echo "$DI_SHA /sbin/dumb-init" | sha256sum -c - \
57-
&& chmod +x /sbin/dumb-init \
58-
&& chmod +x /ready-probe.sh \
62+
&& chmod +x /sbin/dumb-init /ready-probe.sh \
5963
&& mkdir -p /cassandra_data/data /etc/cassandra/triggers \
6064
&& mv /logback.xml /cassandra.yaml /jvm.options /etc/cassandra/ \
6165
&& mv /usr/local/apache-cassandra-${CASSANDRA_VERSION}/conf/cassandra-env.sh /etc/cassandra/ \
@@ -117,7 +121,7 @@ RUN set -e && echo 'debconf debconf/frontend select Noninteractive' | debconf-se
117121
/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/plugin.jar \
118122
/usr/lib/jvm/java-8-openjdk-amd64/man
119123

120-
VOLUME ["/$CASSANDRA_DATA"]
124+
VOLUME ["/cassandra_data"]
121125

122126
# 7000: intra-node communication
123127
# 7001: TLS intra-node communication

files/ready-probe.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
if [[ $(nodetool status | grep $POD_IP) == *"UN"* ]]; then
18-
if [[ $DEBUG ]]; then
19-
echo "Not Up";
20-
fi
21-
exit 0;
17+
if [[ $(/usr/local/apache-cassandra/bin/nodetool status | grep $POD_IP) == *"UN"* ]]; then
18+
if [[ $DEBUG ]]; then echo "Up"; fi
19+
exit 0
2220
else
23-
if [[ $DEBUG ]]; then
24-
echo "Up";
25-
fi
26-
exit 1;
21+
if [[ $DEBUG ]]; then echo "Not Up"; fi
22+
exit 1
2723
fi

files/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ fi
171171
chmod 700 "${CASSANDRA_DATA}"
172172
chown -c -R cassandra: "${CASSANDRA_DATA}" "${CASSANDRA_CONF_DIR}"
173173

174-
su cassandra -c "$CASSANDRA_HOME/bin/cassandra -f"
174+
su cassandra -c "/usr/local/apache-cassandra/bin/cassandra -f"

0 commit comments

Comments
 (0)