Skip to content

Commit ae75fc1

Browse files
Fix for Embedded DB Docker Image (#387)
1 parent 0c645d0 commit ae75fc1

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

.github/workflows/BuildDockerOnTag-Release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,7 @@ jobs:
5959
platforms: linux/amd64,linux/arm64
6060
push: true
6161
tags: |
62+
gaseousgames/gaseousserver:latest-embeddeddb
6263
gaseousgames/gaseousserver:${{ github.ref_name}}-embeddeddb
64+
ghcr.io/gaseous-project/gaseousserver:latest-embeddeddb
6365
ghcr.io/gaseous-project/gaseousserver:${{ github.ref_name}}-embeddeddb

build/Dockerfile-EmbeddedDB

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,28 @@ COPY ../build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
5454
# clean up apt-get
5555
RUN apt-get clean && rm -rf /var/lib/apt/lists
5656

57+
# set user name
58+
ENV USER=gaseous
59+
ENV GROUP=gaseous
60+
61+
# configure user
62+
ENV PUID=1000
63+
ENV PGID=1000
64+
RUN groupadd -g $PGID $USER
65+
RUN useradd -u $PUID -g $GROUP -m $USER -G sudo
66+
RUN usermod -p "*" $USER
67+
68+
# create home directory
69+
RUN mkdir -p /home/$USER/.gaseous-server /var/lib/mysql
70+
71+
# set permissions
72+
RUN chown -R $USER:$GROUP /App /home/$USER/.gaseous-server /var/lib/mysql /run/mysqld
73+
74+
# switch to user
75+
USER $USER
76+
5777
# volumes
58-
VOLUME /root/.gaseous-server /var/lib/mysql
78+
VOLUME /home/$USER/.gaseous-server /var/lib/mysql
5979

6080
# start services
6181
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

build/mariadb.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
#!/bin/bash
22

3-
# Wait for the service to start
4-
while ! mysqladmin ping -h localhost --silent; do
5-
sleep 1
6-
done
3+
# start the database server without network or grant tables
4+
/usr/sbin/mariadbd --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
75

8-
# Set the root password
9-
mariadb -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD';"
6+
# wait for the server to start
7+
sleep 2
8+
9+
# change the root password
10+
mariadb -u root -e "FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD'; FLUSH PRIVILEGES;"
11+
12+
# stop the server
13+
sleep 1
14+
killall mariadbd
15+
16+
# start the server normally
17+
/usr/sbin/mariadbd --datadir=/var/lib/mysql

build/supervisord.conf

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
[supervisord]
2-
user=root
2+
# user=abc
33
nodaemon=true
44
logfile=/dev/null
55
logfile_maxbytes=0
66
pidfile=/var/run/supervisord.pid
77
loglevel = INFO
88

99
[program:mariadb]
10-
command=/usr/sbin/mariadbd --user=root
11-
autostart=true
12-
autorestart=true
13-
redirect_stderr=true
14-
stdout_logfile=/dev/fd/1
15-
stdout_logfile_maxbytes=0
16-
17-
[program:mariadb-setup]
1810
command=bash -c "/usr/sbin/start-mariadb.sh"
1911
autostart=true
20-
autorestart=false
12+
autorestart=true
2113
redirect_stderr=true
2214
stdout_logfile=/dev/fd/1
2315
stdout_logfile_maxbytes=0

0 commit comments

Comments
 (0)