Fix for Embedded DB Docker Image (#387)
This commit is contained in:
@@ -59,5 +59,7 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
gaseousgames/gaseousserver:latest-embeddeddb
|
||||
gaseousgames/gaseousserver:${{ github.ref_name}}-embeddeddb
|
||||
ghcr.io/gaseous-project/gaseousserver:latest-embeddeddb
|
||||
ghcr.io/gaseous-project/gaseousserver:${{ github.ref_name}}-embeddeddb
|
||||
|
@@ -54,8 +54,28 @@ COPY ../build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
# clean up apt-get
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists
|
||||
|
||||
# set user name
|
||||
ENV USER=gaseous
|
||||
ENV GROUP=gaseous
|
||||
|
||||
# configure user
|
||||
ENV PUID=1000
|
||||
ENV PGID=1000
|
||||
RUN groupadd -g $PGID $USER
|
||||
RUN useradd -u $PUID -g $GROUP -m $USER -G sudo
|
||||
RUN usermod -p "*" $USER
|
||||
|
||||
# create home directory
|
||||
RUN mkdir -p /home/$USER/.gaseous-server /var/lib/mysql
|
||||
|
||||
# set permissions
|
||||
RUN chown -R $USER:$GROUP /App /home/$USER/.gaseous-server /var/lib/mysql /run/mysqld
|
||||
|
||||
# switch to user
|
||||
USER $USER
|
||||
|
||||
# volumes
|
||||
VOLUME /root/.gaseous-server /var/lib/mysql
|
||||
VOLUME /home/$USER/.gaseous-server /var/lib/mysql
|
||||
|
||||
# start services
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
|
@@ -1,9 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Wait for the service to start
|
||||
while ! mysqladmin ping -h localhost --silent; do
|
||||
sleep 1
|
||||
done
|
||||
# start the database server without network or grant tables
|
||||
/usr/sbin/mariadbd --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
|
||||
|
||||
# Set the root password
|
||||
mariadb -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD';"
|
||||
# wait for the server to start
|
||||
sleep 2
|
||||
|
||||
# change the root password
|
||||
mariadb -u root -e "FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD'; FLUSH PRIVILEGES;"
|
||||
|
||||
# stop the server
|
||||
sleep 1
|
||||
killall mariadbd
|
||||
|
||||
# start the server normally
|
||||
/usr/sbin/mariadbd --datadir=/var/lib/mysql
|
||||
|
@@ -1,5 +1,5 @@
|
||||
[supervisord]
|
||||
user=root
|
||||
# user=abc
|
||||
nodaemon=true
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
@@ -7,17 +7,9 @@ pidfile=/var/run/supervisord.pid
|
||||
loglevel = INFO
|
||||
|
||||
[program:mariadb]
|
||||
command=/usr/sbin/mariadbd --user=root
|
||||
autostart=true
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
[program:mariadb-setup]
|
||||
command=bash -c "/usr/sbin/start-mariadb.sh"
|
||||
autostart=true
|
||||
autorestart=false
|
||||
autorestart=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
|
Reference in New Issue
Block a user