#!/bin/sh
set -e

SOURCE_DIR=$(realpath $(dirname "${0}"))/rabbitmq

# Build Docker container
docker build -t rabbitmq ${SOURCE_DIR}
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
rc-update -u

# Create RabbitMQ directory structure
mkdir -p /srv/rabbitmq/data
chown 5672:5672 /srv/rabbitmq/data
