Skip to content

Commit 1166c3f

Browse files
author
Pradeep Kunchala
committed
Restore Dockerfile and entrypoint.sh to original state; remove unrelated changes
1 parent 3b71d42 commit 1166c3f

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

assembly/src/docker/Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
################################################################################
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
################################################################################
18+
19+
FROM eclipse-temurin:17-jre
20+
21+
# ActiveMQ environment variables
22+
ENV ACTIVEMQ_INSTALL_PATH /opt
23+
ENV ACTIVEMQ_HOME $ACTIVEMQ_INSTALL_PATH/apache-activemq
24+
ENV ACTIVEMQ_CONF $ACTIVEMQ_HOME/conf
25+
ENV ACTIVEMQ_EXEC exec
26+
ENV PATH $PATH:$ACTIVEMQ_HOME/bin
27+
#WORKDIR $ACTIVEMQ_HOME
28+
29+
# activemq_dist can point to a directory or a tarball on the local system
30+
ARG activemq_dist=NOT_SET
31+
32+
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
33+
34+
# Install build dependencies and activemq
35+
ADD $activemq_dist $ACTIVEMQ_INSTALL_PATH
36+
RUN set -x && \
37+
cp -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-* $ACTIVEMQ_HOME && \
38+
rm -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-*
39+
40+
EXPOSE 8161 61616 5672 61613 1883 61614 1099
41+
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
42+
CMD ["activemq", "console"]

assembly/src/docker/entrypoint.sh

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
3+
################################################################################
4+
# Licensed to the Apache Software Foundation (ASF) under one
5+
# or more contributor license agreements. See the NOTICE file
6+
# distributed with this work for additional information
7+
# regarding copyright ownership. The ASF licenses this file
8+
# to you under the Apache License, Version 2.0 (the
9+
# "License"); you may not use this file except in compliance
10+
# with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
################################################################################
20+
21+
# Transport/connection security
22+
if [ -n "${ACTIVEMQ_CONNECTION_USER}" ]; then
23+
if [ -f "${ACTIVEMQ_HOME}/conf/connection.security.enabled" ]; then
24+
echo "ActiveMQ Connection Security enabled"
25+
else
26+
echo "Enabling ActiveMQ Connection Security"
27+
sed -i "s/activemq.username=system/activemq.username=${ACTIVEMQ_CONNECTION_USER}/" ${ACTIVEMQ_HOME}/conf/credentials.properties
28+
sed -i "s/activemq.password=manager/activemq.password=${ACTIVEMQ_CONNECTION_PASSWORD}/" ${ACTIVEMQ_HOME}/conf/credentials.properties
29+
read -r -d '' REPLACE << END
30+
<plugins>
31+
<simpleAuthenticationPlugin>
32+
<users>
33+
<authenticationUser username="$\{activemq.username}" password="$\{activemq.password}"/>
34+
</users>
35+
</simpleAuthenticationPlugin>
36+
</plugins>
37+
</broker>
38+
END
39+
REPLACE=${REPLACE//$\\/$}
40+
REPLACE=${REPLACE//\//\\\/}
41+
REPLACE=$(echo $REPLACE | tr '\n' ' ')
42+
sed -i "s/<\/broker>/$REPLACE/" ${ACTIVEMQ_HOME}/conf/activemq.xml
43+
touch "${ACTIVEMQ_HOME}/conf/connection.security.enabled"
44+
fi
45+
fi
46+
47+
# JMX security
48+
if [ -n "${ACTIVEMQ_JMX_USER}" ]; then
49+
if [ -f "${ACTIVEMQ_HOME}/conf/jmx.security.enabled" ]; then
50+
echo "JMX Security already enabled"
51+
else
52+
echo "Enabling ActiveMQ JMX security"
53+
read -r -d '' REPLACE << END
54+
<managementContext>
55+
<managementContext createConnector="true" />
56+
</managementContext>
57+
</broker>
58+
END
59+
REPLACE=${REPLACE//\//\\\/}
60+
REPLACE=${REPLACE//$\\/$}
61+
REPLACE=$(echo $REPLACE | tr '\n' ' ')
62+
sed -i "s/<\/broker>/$REPLACE/" ${ACTIVEMQ_HOME}/conf/activemq.xml
63+
sed -i "s/admin/${ACTIVEMQ_JMX_USER}/" ${ACTIVEMQ_HOME}/conf/jmx.access
64+
sed -i "s/admin/${ACTIVEMQ_JMX_USER}/" ${ACTIVEMQ_HOME}/conf/jmx.password
65+
if [ -n "${ACTIVEMQ_JMX_PASSWORD}" ]; then
66+
sed -i "s/\ activemq/\ ${ACTIVEMQ_JMX_PASSWORD}/" ${ACTIVEMQ_HOME}/conf/jmx.password
67+
fi
68+
touch "${ACTIVEMQ_HOME}/conf/jmx.security.enabled"
69+
fi
70+
fi
71+
72+
# WebConsole security
73+
if [ -n "${ACTIVEMQ_WEB_USER}" ]; then
74+
echo "Enabling ActiveMQ WebConsole security"
75+
sed -i s/admin=/${ACTIVEMQ_WEB_USER}=/g ${ACTIVEMQ_HOME}/conf/users.properties
76+
if [ -n "${ACTIVEMQ_WEB_PASSWORD}" ]; then
77+
sed -i s/=admin/=${ACTIVEMQ_WEB_PASSWORD}/g ${ACTIVEMQ_HOME}/conf/users.properties
78+
fi
79+
fi
80+
81+
if [ -z "${ACTIVEMQ_OPTS_MEMORY}" ]; then
82+
ACTIVEMQ_OPTS_MEMORY="-Xms64M -Xmx1G"
83+
export ACTIVEMQ_OPTS_MEMORY
84+
fi
85+
86+
if [ -z "${ACTIVEMQ_OPTS}" ]; then
87+
# Make the Web console accesible from outside the container if not already set
88+
ACTIVEMQ_OPTS="${ACTIVEMQ_OPTS_MEMORY} -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=${ACTIVEMQ_CONF}/login.config -Djetty.host=0.0.0.0"
89+
export ACTIVEMQ_OPTS
90+
fi
91+
92+
exec "$@"

0 commit comments

Comments
 (0)