rabbitmq/Dockerfile
Arnaud G. GIBERT ef8a780452 - Move & Rename repo from Rx3/RabbitMQ-MGA9 to Rx3-Docker/RabbitMQ,
- New version naming standard,
- Now use docker_tools for .env building,
- Use now rx3-docker/server:1.2.0-mga9 image,
- Add /var/log/init & /var/log/supervisor volumes,
- Add healthcheck example in compose file.
2024-11-12 21:52:33 +01:00

100 lines
8.9 KiB
Docker

# Rx3-Docker/RabbitMQ Docker Image
#-------------------------------------------------------------------------------
ARG IMG_FROM_URL="rx3-docker/server:latest"
FROM ${IMG_FROM_URL}
ARG IMG_NAME
ARG IMG_NAME_FULL
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
ARG RABBITMQ_LIB
ARG RABBITMQ_PORT_MAIN
ARG RABBITMQ_PORT_ADMIN
ARG POSTRMQ_LOG_DIR
ARG POSTRMQ_LOG_FILE="${POSTRMQ_LOG_DIR}/postrmq.log"
ARG RABBITMQ_LIB=/var/lib/rabbitmq
ARG RABBITMQ_PORT=5672
ARG RABBITMQ_ADMIN_PORT=15672
#-------------------------------------------------------------------------------------------------------------------
ARG RABBITMQD='#!/bin/bash \n\
\n\
usermod -u ${RABBITMQ_UID} -s /bin/bash rabbitmq \n\
groupmod -g ${RABBITMQ_GID} rabbitmq \n\
\n\
chown -R rabbitmq:rabbitmq '${RABBITMQ_LIB}' /var/log/rabbitmq /var/run/rabbitmq'
#-------------------------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------
ARG RABBITMQD_INI='[program:rabbitmqd] \n\
command=su - rabbitmq -c /usr/lib/rabbitmq/bin/rabbitmq-server \n\
user=root'
#-------------------------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------
ARG POSTRMQ='#!/bin/bash \n\
\n\
function log() { echo "$(date --rfc-3339=ns) PostRMQ: $*" | tee -a '${POSTRMQ_LOG_FILE}'; } \n\
\n\
log "Starting" \n\
\n\
for i in {30..0} \n\
do \n\
if curl http://127.0.0.1:'${RABBITMQ_ADMIN_PORT}'/cli/rabbitmqadmin &> /dev/null \n\
then \n\
break \n\
fi \n\
\n\
sleep 1 \n\
done \n\
\n\
if [ "$i" = 0 ] \n\
then \n\
log "Unable to connect to server" \n\
else \n\
log "Downloading rabbitmqadmin" \n\
curl -o /usr/local/bin/rabbitmqadmin http://127.0.0.1:'${RABBITMQ_ADMIN_PORT}'/cli/rabbitmqadmin &>/dev/null \n\
\n\
chmod a+rx /usr/local/bin/rabbitmqadmin \n\
fi \n\
\n\
log "Completed"'
#-------------------------------------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------------------------------------
ARG POSTRMQ_INI='[program:postrmq] \n\
command=/usr/local/sbin/postrmq'
#-------------------------------------------------------------------------------------------------------------------
RUN urpmi --force lksctp-tools \
&& rpm -Uvh http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-erts-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-crypto-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-kernel-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-stdlib-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-syntax_tools-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-hipe-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-compiler-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-mnesia-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-runtime_tools-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-asn1-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-public_key-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-ssl-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-inets-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-tools-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-sasl-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-eldap-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-snmp-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-os_mon-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/release/erlang-sd_notify-1.1-1.mga8.noarch.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/erlang-xmerl-23.2.1-3.2.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/rabbitmq-server-3.8.18-1.mga8.x86_64.rpm http://mirror.xor.rx3/mageia/distrib/8/x86_64/media/core/updates/lib64openssl1.1-1.1.1v-1.mga8.x86_64.rpm \
&& rabbitmq-plugins enable rabbitmq_management \
&& echo -e "${RABBITMQD}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/rabbitmqd \
&& chmod a+x /etc/init.d/rabbitmqd \
&& ln -s /etc/init.d/rabbitmqd /etc/rcD.d/S40rabbitmqd \
&& echo -e "${RABBITMQD_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/rabbitmqd.ini \
&& echo -e "${POSTRMQ}" | sed -e "s/\`/'/g" -e 's/ *$//' > /usr/local/sbin/postrmq \
&& chmod a+x /usr/local/sbin/postrmq \
&& echo -e "${POSTRMQ_INI}" | sed -e 's/ *$//' > /etc/supervisord.d/postrmq.ini
VOLUME ${RABBITMQ_LIB}
EXPOSE ${RABBITMQ_PORT_MAIN}
EXPOSE ${RABBITMQ_PORT_ADMIN}