-
Notifications
You must be signed in to change notification settings - Fork 411
/
Dockerfile
93 lines (79 loc) · 2.84 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
FROM alpine:3.6
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN addgroup -S rabbitmq && adduser -S -h /var/lib/rabbitmq -G rabbitmq rabbitmq
# grab su-exec for easy step-down from root
RUN apk add --no-cache 'su-exec>=0.2'
RUN apk add --no-cache \
# Bash for docker-entrypoint
bash \
# Procps for rabbitmqctl
procps \
# Erlang for RabbitMQ
erlang-asn1 \
erlang-hipe \
erlang-crypto \
erlang-eldap \
erlang-inets \
erlang-mnesia \
erlang \
erlang-os-mon \
erlang-public-key \
erlang-sasl \
erlang-ssl \
erlang-syntax-tools \
erlang-xmerl
# get logs to stdout (thanks @dumbbell for pushing this upstream! :D)
ENV RABBITMQ_LOGS=- RABBITMQ_SASL_LOGS=-
# https://github.com/rabbitmq/rabbitmq-server/commit/53af45bf9a162dec849407d114041aad3d84feaf
ENV RABBITMQ_HOME /opt/rabbitmq
ENV PATH $RABBITMQ_HOME/sbin:$PATH
# https://www.rabbitmq.com/install-generic-unix.html
ENV GPG_KEY 0A9AF2115F4687BD29803A206B73A36E6026DFCA
ENV RABBITMQ_VERSION 3.6.12
RUN set -ex; \
\
apk add --no-cache --virtual .build-deps \
ca-certificates \
gnupg \
libressl \
tar \
xz \
; \
\
wget -O rabbitmq-server.tar.xz "https://www.rabbitmq.com/releases/rabbitmq-server/v${RABBITMQ_VERSION}/rabbitmq-server-generic-unix-${RABBITMQ_VERSION}.tar.xz"; \
wget -O rabbitmq-server.tar.xz.asc "https://www.rabbitmq.com/releases/rabbitmq-server/v${RABBITMQ_VERSION}/rabbitmq-server-generic-unix-${RABBITMQ_VERSION}.tar.xz.asc"; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY"; \
gpg --batch --verify rabbitmq-server.tar.xz.asc rabbitmq-server.tar.xz; \
rm -rf "$GNUPGHOME" rabbitmq-server.tar.xz.asc; \
\
mkdir -p "$RABBITMQ_HOME"; \
tar \
--extract \
--verbose \
--file rabbitmq-server.tar.xz \
--directory "$RABBITMQ_HOME" \
--strip-components 1 \
; \
rm rabbitmq-server.tar.xz; \
\
# update SYS_PREFIX (first making sure it's set to what we expect it to be)
grep -qE '^SYS_PREFIX=\$\{RABBITMQ_HOME\}$' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \
sed -ri 's!^(SYS_PREFIX=).*$!\1!g' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \
grep -qE '^SYS_PREFIX=$' "$RABBITMQ_HOME/sbin/rabbitmq-defaults"; \
\
apk del .build-deps
# set home so that any `--user` knows where to put the erlang cookie
ENV HOME /var/lib/rabbitmq
RUN mkdir -p /var/lib/rabbitmq /etc/rabbitmq \
&& chown -R rabbitmq:rabbitmq /var/lib/rabbitmq /etc/rabbitmq \
&& chmod -R 777 /var/lib/rabbitmq /etc/rabbitmq
VOLUME /var/lib/rabbitmq
# add a symlink to the .erlang.cookie in /root so we can "docker exec rabbitmqctl ..." without gosu
RUN ln -sf /var/lib/rabbitmq/.erlang.cookie /root/
RUN ln -sf "$RABBITMQ_HOME/plugins" /plugins
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 4369 5671 5672 25672
CMD ["rabbitmq-server"]