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"]
