Add RabbitMQ Dockerfile + script
This commit is contained in:
parent
89bf24d6cf
commit
770c6fbd8e
15
rabbitmq.sh
Executable file
15
rabbitmq.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SOURCE_DIR=$(realpath $(dirname "${0}"))/rabbitmq
|
||||||
|
|
||||||
|
# Build Docker container
|
||||||
|
docker build -t rabbitmq ${SOURCE_DIR}
|
||||||
|
|
||||||
|
# Create RabbitMQ directory structure
|
||||||
|
mkdir -p /srv/rabbitmq/data
|
||||||
|
chown 5672:5672 /srv/rabbitmq/data
|
||||||
|
|
||||||
|
# Configure RabbitMQ service
|
||||||
|
cp ${SOURCE_DIR}/etc/init.d/rabbitmq /etc/init.d/rabbitmq
|
||||||
|
rc-update add rabbitmq boot
|
||||||
|
service rabbitmq start
|
17
rabbitmq/Dockerfile
Normal file
17
rabbitmq/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
FROM alpine:3.7
|
||||||
|
MAINTAINER Disassembler <disassembler@dasm.cz>
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
# Create OS user (which will be picked up later by apk add)
|
||||||
|
addgroup -S -g 5672 rabbitmq \
|
||||||
|
&& adduser -S -u 5672 -h /usr/lib/rabbitmq -s /sbin/nologin -g rabbitmq -G rabbitmq rabbitmq \
|
||||||
|
# Add edge/testing repository
|
||||||
|
&& echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >>/etc/apk/repositories \
|
||||||
|
# Install RabbitMQ
|
||||||
|
&& apk --no-cache add rabbitmq-server
|
||||||
|
|
||||||
|
VOLUME ["/var/lib/rabbitmq/mnesia"]
|
||||||
|
EXPOSE 5672
|
||||||
|
|
||||||
|
USER rabbitmq
|
||||||
|
CMD ["rabbitmq-server"]
|
16
rabbitmq/etc/init.d/rabbitmq
Executable file
16
rabbitmq/etc/init.d/rabbitmq
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
description="RabbitMQ docker container"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need docker net
|
||||||
|
use dns logger netmount
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
/usr/bin/docker run -d --rm --name rabbitmq -v /srv/rabbitmq/data:/var/lib/rabbitmq/mnesia rabbitmq
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
/usr/bin/docker stop rabbitmq
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user