1
1
# vim:set ft=dockerfile:
2
- FROM alpine:3.17
2
+
3
+ # We grab RabbitMQ and Erlang from the official RabbitMQ image
4
+ FROM rabbitmq:3-alpine AS rabbit
5
+
6
+ # Build our own image
7
+ FROM alpine:3.18
3
8
4
9
LABEL maintainer=
"Justin Clift <[email protected] >"
5
10
6
- # Install Git, Go, Memcached, Minio, OpenRC, PostgreSQL, and RabbitMQ
7
- RUN \
8
- apk update && \
11
+ # Copy the RabbitMQ files we need
12
+ COPY --from=rabbit /etc/rabbitmq /etc/rabbitmq
13
+ COPY --from=rabbit /opt/erlang /opt/erlang
14
+ COPY --from=rabbit /opt/openssl /opt/openssl
15
+ COPY --from=rabbit /opt/rabbitmq /opt/rabbitmq
16
+ COPY --from=rabbit /var/lib/rabbitmq /var/lib/rabbitmq
17
+ COPY --from=rabbit /var/log/rabbitmq /var/log/rabbitmq
18
+
19
+ # Create the rabbitmq user and group
20
+ RUN addgroup -S rabbitmq && \
21
+ adduser -S -D -h /var/lib/rabbitmq -s /sbin/nologin -g "Linux User,,," -G rabbitmq rabbitmq && \
22
+ chown -Rh rabbitmq: /opt/rabbitmq /var/log/rabbitmq
23
+
24
+ # Install Git, Go, Memcached, Minio, OpenRC, and PostgreSQL
25
+ RUN apk update && \
9
26
apk upgrade && \
10
27
apk add --no-cache ca-certificates 'curl>7.61.0' file git go libc-dev make memcached minio openrc openssl openssl-dev postgresql yarn && \
11
- apk add rabbitmq-server --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ && \
12
28
rc-update add memcached default && \
13
29
rc-update add minio default && \
14
- rc-update add postgresql default && \
15
- rc-update add rabbitmq-server default && \
16
- mkdir /etc/rabbitmq && \
17
- rabbitmq-plugins enable rabbitmq_management && \
18
- rabbitmq-plugins enable rabbitmq_top
30
+ rc-update add postgresql
19
31
20
32
# Create the DBHub.io OS user
21
33
RUN addgroup dbhub && \
@@ -31,7 +43,7 @@ ENV MINIO_ROOT_PASSWORD minio123
31
43
RUN sed -i "s/^MINIO_ROOT_USER=\" change-me\" /MINIO_ROOT_USER=\" ${MINIO_ROOT_USER}\" /" /etc/conf.d/minio && \
32
44
sed -i "s/^MINIO_ROOT_PASSWORD=\" change-me\" /MINIO_ROOT_PASSWORD=\" ${MINIO_ROOT_PASSWORD}\" /" /etc/conf.d/minio
33
45
34
- # Run each of our daemon dependencies at least once to ensure they initialise ok, and populate the DBHub.io database
46
+ # Run each of our (non RabbitMQ) daemon dependencies at least once to ensure they initialise ok, and populate the DBHub.io database
35
47
RUN echo "openrc nonetwork" >> /usr/local/bin/init.sh && \
36
48
echo "openrc default stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
37
49
echo "createuser -U postgres -d dbhub" >> /usr/local/bin/init.sh && \
@@ -40,7 +52,6 @@ RUN echo "openrc nonetwork" >> /usr/local/bin/init.sh && \
40
52
echo "rc-service memcached stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
41
53
echo "rc-service minio stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
42
54
echo "rc-service postgresql stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
43
- echo "rc-service rabbitmq-server stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
44
55
chmod +x /usr/local/bin/init.sh
45
56
46
57
# Set the dependencies and DBHub.io daemons to automatically start
@@ -62,6 +73,11 @@ RUN GOBIN=/usr/local/bin go install github.com/go-delve/delve/cmd/dlv@latest
62
73
RUN echo "echo 127.0.0.1 docker-dev.dbhub.io docker-dev >> /etc/hosts" >> /usr/local/bin/start.sh && \
63
74
echo "openrc default" >> /usr/local/bin/start.sh && \
64
75
echo "" >> /usr/local/bin/start.sh && \
76
+ echo "unset CONFIG_FILE" >> /usr/local/bin/start.sh && \
77
+ echo "export RABBITMQ_CONFIG_FILES=/etc/rabbitmq/conf.d" >> /usr/local/bin/start.sh && \
78
+ echo "export PATH=/opt/rabbitmq/sbin:/opt/erlang/bin:/opt/openssl/bin:$PATH" >> /usr/local/bin/start.sh && \
79
+ echo "/opt/rabbitmq/sbin/rabbitmq-server &" >> /usr/local/bin/start.sh && \
80
+ echo "" >> /usr/local/bin/start.sh && \
65
81
echo "# Wait for RabbitMQ to start before launching the DBHub.io daemons" >> /usr/local/bin/start.sh && \
66
82
echo "sleep 15" >> /usr/local/bin/start.sh && \
67
83
echo "" >> /usr/local/bin/start.sh && \
0 commit comments