File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,14 +29,23 @@ ENV PATH $PATH:$ACTIVEMQ_HOME/bin
2929# activemq_dist can point to a directory or a tarball on the local system
3030ARG activemq_dist=NOT_SET
3131
32+ RUN groupadd -r activemq && useradd -r -g activemq activemq
33+
3234COPY entrypoint.sh /usr/local/bin/entrypoint.sh
35+ RUN chown activemq:activemq /usr/local/bin/entrypoint.sh && chmod +x /usr/local/bin/entrypoint.sh
3336
3437# Install build dependencies and activemq
3538ADD $activemq_dist $ACTIVEMQ_INSTALL_PATH
3639RUN set -x && \
3740 cp -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-* $ACTIVEMQ_HOME && \
3841 rm -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-*
3942
43+ RUN chown -R activemq:activemq $ACTIVEMQ_HOME
44+
45+ STOPSIGNAL SIGTERM
46+
47+ USER activemq
48+
4049EXPOSE 8161 61616 5672 61613 1883 61614 1099
4150ENTRYPOINT ["/usr/local/bin/entrypoint.sh" ]
4251CMD ["activemq" , "console" ]
Original file line number Diff line number Diff line change @@ -89,4 +89,17 @@ if [ -z "${ACTIVEMQ_OPTS}" ]; then
8989 export ACTIVEMQ_OPTS
9090fi
9191
92- exec " $@ "
92+ _term () {
93+ echo " Received signal, stopping ActiveMQ..."
94+ if [ -n " ${child_pid:- } " ] && kill -0 " ${child_pid} " 2> /dev/null; then
95+ kill -TERM " ${child_pid} " 2> /dev/null || true
96+ fi
97+ }
98+
99+ trap _term TERM INT
100+
101+ " $@ " &
102+ child_pid=$!
103+ wait " ${child_pid} "
104+
105+ exit $?
You can’t perform that action at this time.
0 commit comments