@@ -21,13 +21,10 @@ RUN addgroup -S rabbitmq && \
21
21
adduser -S -D -h /var/lib/rabbitmq -s /sbin/nologin -g "Linux User,,," -G rabbitmq rabbitmq && \
22
22
chown -Rh rabbitmq: /opt/rabbitmq /var/log/rabbitmq
23
23
24
- # Install Git, Go, Memcached, Minio, OpenRC, and PostgreSQL
24
+ # Install Git, Go, Memcached, Minio, and PostgreSQL
25
25
RUN apk update && \
26
26
apk upgrade && \
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 && \
28
- rc-update add memcached default && \
29
- rc-update add minio default && \
30
- rc-update add postgresql
27
+ apk add --no-cache ca-certificates 'curl>7.61.0' file git go libc-dev make memcached minio openssl openssl-dev postgresql shadow yarn
31
28
32
29
# Create the DBHub.io OS user
33
30
RUN addgroup dbhub && \
@@ -40,18 +37,24 @@ ENV DBHUB_SOURCE /dbhub.io
40
37
ENV MINIO_ROOT_USER minio
41
38
ENV MINIO_ROOT_PASSWORD minio123
42
39
43
- RUN sed -i "s/^MINIO_ROOT_USER=\" change-me\" /MINIO_ROOT_USER=\" ${MINIO_ROOT_USER}\" /" /etc/conf.d/minio && \
44
- sed -i "s/^MINIO_ROOT_PASSWORD=\" change-me\" /MINIO_ROOT_PASSWORD=\" ${MINIO_ROOT_PASSWORD}\" /" /etc/conf.d/minio
45
-
46
40
# Run each of our (non RabbitMQ) daemon dependencies at least once to ensure they initialise ok, and populate the DBHub.io database
47
- RUN echo "openrc nonetwork" >> /usr/local/bin/init.sh && \
48
- echo "openrc default stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
41
+ RUN echo "echo export PGDATA=/var/lib/postgresql/data > ~postgres/.profile" >> /usr/local/bin/init.sh && \
42
+ echo "echo export MINIO_ROOT_USER=${MINIO_ROOT_USER} > ~minio/.profile" >> /usr/local/bin/init.sh && \
43
+ echo "echo export MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} >> ~minio/.profile" >> /usr/local/bin/init.sh && \
44
+ echo "su - postgres -c '/usr/libexec/postgresql/initdb --locale=en_US.UTF-8'" >> /usr/local/bin/init.sh && \
45
+ echo "mkdir /run/postgresql /home/memcached" >> /usr/local/bin/init.sh && \
46
+ echo "chown memcached: /home/memcached" >> /usr/local/bin/init.sh && \
47
+ echo "chown -R minio: /var/lib/minio" >> /usr/local/bin/init.sh && \
48
+ echo "chown -R postgres: /var/lib/postgresql /run/postgresql" >> /usr/local/bin/init.sh && \
49
+ echo "usermod -s /bin/sh memcached" >> /usr/local/bin/init.sh && \
50
+ echo "usermod -s /bin/sh minio" >> /usr/local/bin/init.sh && \
51
+ echo "su - postgres -c '/usr/libexec/postgresql/pg_ctl start'" >> /usr/local/bin/init.sh && \
49
52
echo "createuser -U postgres -d dbhub" >> /usr/local/bin/init.sh && \
50
53
echo "createdb -U postgres -O dbhub dbhub" >> /usr/local/bin/init.sh && \
51
54
echo "su - dbhub -c 'psql dbhub < ${DBHUB_SOURCE}/database/dbhub.sql'" >> /usr/local/bin/init.sh && \
52
- echo "rc-service memcached stop 2>&1 | grep -v 'Read-only file system '" >> /usr/local/bin/init.sh && \
53
- echo "rc-service minio stop 2>&1 | grep -v 'Read-only file system '" >> /usr/local/bin/init.sh && \
54
- echo "rc-service postgresql stop 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
55
+ echo "su - memcached -c '/usr/bin/memcached -d '" >> /usr/local/bin/init.sh && \
56
+ echo "su - minio -c '/usr/bin/minio server --quiet --anonymous /var/lib/minio/data 2>&1 & '" >> /usr/local/bin/init.sh && \
57
+ echo "su - postgres -c '/usr/libexec/ postgresql/pg_ctl stop' 2>&1 | grep -v 'Read-only file system'" >> /usr/local/bin/init.sh && \
55
58
chmod +x /usr/local/bin/init.sh
56
59
57
60
# Set the dependencies and DBHub.io daemons to automatically start
@@ -69,9 +72,11 @@ ENV CONFIG_FILE ${DBHUB_SOURCE}/docker/config.toml
69
72
RUN GOBIN=/usr/local/bin go install github.com/go-delve/delve/cmd/dlv@latest
70
73
71
74
# Add script pieces for starting DBHub.io services
72
- # These don't use openrc. Not sure if it'd be useful. Maybe a task for a different day?
73
75
RUN echo "echo 127.0.0.1 docker-dev.dbhub.io docker-dev >> /etc/hosts" >> /usr/local/bin/start.sh && \
74
- echo "openrc default" >> /usr/local/bin/start.sh && \
76
+ echo "echo nameserver 8.8.8.8 > /etc/resolv.conf" >> /usr/local/bin/start.sh && \
77
+ echo "su - memcached -c '/usr/bin/memcached -d'" >> /usr/local/bin/start.sh && \
78
+ echo "su - minio -c '/usr/bin/minio server --quiet --anonymous /var/lib/minio/data 2>&1 &'" >> /usr/local/bin/start.sh && \
79
+ echo "su - postgres -c '/usr/libexec/postgresql/pg_ctl start'" >> /usr/local/bin/start.sh && \
75
80
echo "" >> /usr/local/bin/start.sh && \
76
81
echo "unset CONFIG_FILE" >> /usr/local/bin/start.sh && \
77
82
echo "export RABBITMQ_CONFIG_FILES=/etc/rabbitmq/conf.d" >> /usr/local/bin/start.sh && \
0 commit comments