@@ -21,13 +21,10 @@ RUN addgroup -S rabbitmq && \
2121 adduser -S -D -h /var/lib/rabbitmq -s /sbin/nologin -g "Linux User,,," -G rabbitmq rabbitmq && \
2222 chown -Rh rabbitmq: /opt/rabbitmq /var/log/rabbitmq
2323
24- # Install Git, Go, Memcached, Minio, OpenRC, and PostgreSQL
24+ # Install Git, Go, Memcached, Minio, and PostgreSQL
2525RUN apk update && \
2626 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
3128
3229# Create the DBHub.io OS user
3330RUN addgroup dbhub && \
@@ -40,18 +37,24 @@ ENV DBHUB_SOURCE /dbhub.io
4037ENV MINIO_ROOT_USER minio
4138ENV MINIO_ROOT_PASSWORD minio123
4239
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-
4640# 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 && \
4952 echo "createuser -U postgres -d dbhub" >> /usr/local/bin/init.sh && \
5053 echo "createdb -U postgres -O dbhub dbhub" >> /usr/local/bin/init.sh && \
5154 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 && \
5558 chmod +x /usr/local/bin/init.sh
5659
5760# Set the dependencies and DBHub.io daemons to automatically start
@@ -69,9 +72,11 @@ ENV CONFIG_FILE ${DBHUB_SOURCE}/docker/config.toml
6972RUN GOBIN=/usr/local/bin go install github.com/go-delve/delve/cmd/dlv@latest
7073
7174# 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?
7375RUN 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 && \
7580 echo "" >> /usr/local/bin/start.sh && \
7681 echo "unset CONFIG_FILE" >> /usr/local/bin/start.sh && \
7782 echo "export RABBITMQ_CONFIG_FILES=/etc/rabbitmq/conf.d" >> /usr/local/bin/start.sh && \
0 commit comments