Another attempt at fixing the Embedded DB Docker image (#388)
This commit is contained in:
@@ -23,6 +23,7 @@ RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime
|
|||||||
# RUN mkdir -p out/wwwroot/emulators/EmulatorJS
|
# RUN mkdir -p out/wwwroot/emulators/EmulatorJS
|
||||||
# RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
|
# RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
|
||||||
# RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
|
# RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
|
||||||
|
|
||||||
RUN wget --recursive --no-parent https://cdn.emulatorjs.org/latest/
|
RUN wget --recursive --no-parent https://cdn.emulatorjs.org/latest/
|
||||||
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
|
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
|
||||||
RUN cp -fr cdn.emulatorjs.org/latest/* out/wwwroot/emulators/EmulatorJS
|
RUN cp -fr cdn.emulatorjs.org/latest/* out/wwwroot/emulators/EmulatorJS
|
||||||
@@ -35,10 +36,19 @@ WORKDIR /App
|
|||||||
COPY --from=build-env /App/out .
|
COPY --from=build-env /App/out .
|
||||||
|
|
||||||
# variables
|
# variables
|
||||||
ENV dbhost=localhost
|
ARG PUID=1000
|
||||||
ENV dbuser=root
|
ARG PGID=1000
|
||||||
ENV dbpass=gaseous
|
ARG dbhost=localhost
|
||||||
ENV MARIADB_ROOT_PASSWORD=$dbpass
|
ARG dbuser=root
|
||||||
|
ARG dbpass=gaseous
|
||||||
|
ARG MARIADB_ROOT_PASSWORD=$dbpass
|
||||||
|
|
||||||
|
ENV PUID=${PUID}
|
||||||
|
ENV PGID=${PGID}
|
||||||
|
ENV dbhost=${dbhost}
|
||||||
|
ENV dbuser=${dbuser}
|
||||||
|
ENV dbpass=${dbpass}
|
||||||
|
ENV MARIADB_ROOT_PASSWORD=${dbpass}
|
||||||
|
|
||||||
# install mariadb
|
# install mariadb
|
||||||
RUN DEBIAN_FRONTEND=noninteractive && \
|
RUN DEBIAN_FRONTEND=noninteractive && \
|
||||||
@@ -50,32 +60,18 @@ RUN chmod +x /usr/sbin/start-mariadb.sh
|
|||||||
# install supervisord
|
# install supervisord
|
||||||
RUN apt-get install -y supervisor
|
RUN apt-get install -y supervisor
|
||||||
COPY ../build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
COPY ../build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
RUN mkdir -p /var/run/supervisord
|
||||||
|
RUN mkdir -p /var/log/supervisord
|
||||||
|
|
||||||
# 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
|
# copy entrypoint
|
||||||
ENV USER=gaseous
|
COPY ../build/entrypoint.sh /usr/sbin/entrypoint.sh
|
||||||
ENV GROUP=gaseous
|
RUN chmod +x /usr/sbin/entrypoint.sh
|
||||||
|
|
||||||
# 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 /home/$USER/.gaseous-server /var/lib/mysql
|
VOLUME /home/gaseous/.gaseous-server /var/lib/mysql
|
||||||
|
|
||||||
# start services
|
# start services
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
ENTRYPOINT [ "/usr/sbin/entrypoint.sh" ]
|
||||||
|
12
build/entrypoint.sh
Normal file
12
build/entrypoint.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# create the user
|
||||||
|
echo "Creating user gaseous with UID ${PUID} and GID ${PGID}"
|
||||||
|
groupadd -g ${PGID} gaseous
|
||||||
|
useradd -u ${PUID} -g ${PGID} -m gaseous -G sudo
|
||||||
|
usermod -p "*" gaseous
|
||||||
|
mkdir -p /home/gaseous/.gaseous-server /var/lib/mysql
|
||||||
|
chown -R ${PUID}:${PGID} /App /home/gaseous/.gaseous-server /var/lib/mysql /run/mysqld
|
||||||
|
|
||||||
|
# Start supervisord and services
|
||||||
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
@@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# start the database server without network or grant tables
|
# start the database server without network or grant tables
|
||||||
/usr/sbin/mariadbd --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
|
/usr/sbin/mariadbd --datadir=/var/lib/mysql --skip-grant-tables --skip-networking &
|
||||||
|
|
||||||
# wait for the server to start
|
# wait for the server to start
|
||||||
sleep 2
|
sleep 5
|
||||||
|
|
||||||
# change the root password
|
# change the root password
|
||||||
mariadb -u root -e "FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD'; FLUSH PRIVILEGES;"
|
mariadb -u root -e "FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY '$MARIADB_ROOT_PASSWORD'; FLUSH PRIVILEGES;"
|
||||||
|
|
||||||
# stop the server
|
# stop the server
|
||||||
sleep 1
|
sleep 5
|
||||||
killall mariadbd
|
killall mariadbd
|
||||||
|
|
||||||
# start the server normally
|
# start the server normally
|
||||||
|
@@ -1,12 +1,23 @@
|
|||||||
[supervisord]
|
[supervisord]
|
||||||
# user=abc
|
|
||||||
nodaemon=true
|
nodaemon=true
|
||||||
logfile=/dev/null
|
logfile=/var/log/supervisord/supervisord.log
|
||||||
logfile_maxbytes=0
|
logfile_maxbytes=50
|
||||||
pidfile=/var/run/supervisord.pid
|
logfile_backups=5
|
||||||
loglevel = INFO
|
pidfile=/var/run/supervisord/supervisord.pid
|
||||||
|
loglevel = info
|
||||||
|
|
||||||
|
[unix_http_server]
|
||||||
|
file=/var/run/supervisord/supervisor.sock
|
||||||
|
chmod=0700
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl=unix:///var/run/supervisord/supervisor.sock
|
||||||
|
|
||||||
[program:mariadb]
|
[program:mariadb]
|
||||||
|
user=gaseous
|
||||||
command=bash -c "/usr/sbin/start-mariadb.sh"
|
command=bash -c "/usr/sbin/start-mariadb.sh"
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
@@ -15,9 +26,10 @@ stdout_logfile=/dev/fd/1
|
|||||||
stdout_logfile_maxbytes=0
|
stdout_logfile_maxbytes=0
|
||||||
|
|
||||||
[program:gaseous-server]
|
[program:gaseous-server]
|
||||||
|
user=gaseous
|
||||||
command=dotnet /App/gaseous-server.dll
|
command=dotnet /App/gaseous-server.dll
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
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
|
||||||
|
Reference in New Issue
Block a user