Fix for Embedded DB Docker Image (#387)

This commit is contained in:
Michael Green
2024-07-08 08:29:32 +10:00
committed by GitHub
parent 0c645d04aa
commit ae75fc1490
4 changed files with 39 additions and 17 deletions

View File

@@ -59,5 +59,7 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: | tags: |
gaseousgames/gaseousserver:latest-embeddeddb
gaseousgames/gaseousserver:${{ github.ref_name}}-embeddeddb gaseousgames/gaseousserver:${{ github.ref_name}}-embeddeddb
ghcr.io/gaseous-project/gaseousserver:latest-embeddeddb
ghcr.io/gaseous-project/gaseousserver:${{ github.ref_name}}-embeddeddb ghcr.io/gaseous-project/gaseousserver:${{ github.ref_name}}-embeddeddb

View File

@@ -54,8 +54,28 @@ COPY ../build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# clean up apt-get # clean up apt-get
RUN apt-get clean && rm -rf /var/lib/apt/lists 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 # volumes
VOLUME /root/.gaseous-server /var/lib/mysql VOLUME /home/$USER/.gaseous-server /var/lib/mysql
# start services # start services
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@@ -1,9 +1,17 @@
#!/bin/bash #!/bin/bash
# Wait for the service to start # start the database server without network or grant tables
while ! mysqladmin ping -h localhost --silent; do /usr/sbin/mariadbd --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
sleep 1
done
# Set the root password # wait for the server to start
mariadb -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD';" 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

View File

@@ -1,5 +1,5 @@
[supervisord] [supervisord]
user=root # user=abc
nodaemon=true nodaemon=true
logfile=/dev/null logfile=/dev/null
logfile_maxbytes=0 logfile_maxbytes=0
@@ -7,17 +7,9 @@ pidfile=/var/run/supervisord.pid
loglevel = INFO loglevel = INFO
[program:mariadb] [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" command=bash -c "/usr/sbin/start-mariadb.sh"
autostart=true autostart=true
autorestart=false autorestart=true
redirect_stderr=true redirect_stderr=true
stdout_logfile=/dev/fd/1 stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0