FROM rabbitmq:3.7-management

ENV DELAYED_MESSAGE_PATH=https://dl.bintray.com/rabbitmq/community-plugins/3.7.x/rabbitmq_delayed_message_exchange/rabbitmq_delayed_message_exchange-20171201-3.7.x.zip
ENV DELAYED_MESSAGE_VERSION=20171201-3.7.x
ENV RABBITMQ_PLUGIN_DIR=/plugins
ENV DELAYED_MESSAGE_TARGET=$RABBITMQ_PLUGIN_DIR/rabbitmq_delayed_message_exchange-$DELAYED_MESSAGE_VERSION.ez

RUN apt update \
  && apt install -y --no-install-recommends wget ca-certificates unzip \
  && cd /tmp && wget $DELAYED_MESSAGE_PATH \
  && unzip rabbitmq_delayed_message_exchange-20171201-3.7.x.zip \
  && mkdir -p $RABBITMQ_PLUGIN_DIR && mv *.ez $DELAYED_MESSAGE_TARGET 
RUN rabbitmq-plugins list \
  && rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange \
  && apt remove -y wget ca-certificates \
  && rm -rf /var/lib/apt/lists/* \