First rebuild

This commit is contained in:
Shadchamp
2025-08-28 18:54:35 -04:00
parent 512c1ffc38
commit 9a4c65582b
2 changed files with 12 additions and 19 deletions

View File

@@ -49,15 +49,6 @@ RUN dnf -y install php-pear php-devel gcc make ImageMagick-devel \
&& echo "extension=redis.so" > /etc/php.d/40-redis.ini \
&& echo "extension=imagick.so" > /etc/php.d/40-imagick.ini
# Install and enable dnf-automatic for automatic updates
RUN dnf -y install dnf-automatic \
&& systemctl enable dnf-automatic.timer
# Configure dnf-automatic to run updates at midnight UTC
RUN sed -i 's/^OnCalendar=.*/OnCalendar=*-*-* 00:00:00 UTC/' /usr/lib/systemd/system/dnf-automatic.timer
# Set up MariaDB
RUN mkdir -p /run/mysqld && chown mysql:mysql /run/mysqld
@@ -72,11 +63,6 @@ RUN sed -i '/^;extension=iconv/s/^;//' /etc/php.ini \
&& sed -i '/^;extension=intl/s/^;//' /etc/php.ini
# Install bun globally using npm
RUN npm install -g bun || npm update -g bun
# Disable remote login for MariaDB (MySQL)
RUN echo "[mysqld]\nskip-networking\nskip-bind-address" >> /etc/my.cnf.d/disable-remote.cnf
@@ -88,6 +74,7 @@ RUN useradd -r -s /sbin/nologin unit3d \
&& mkdir -p /var/www/html \
&& chown unit3d:unit3d /var/www/html
RUN mkdir -p /run/php-fpm
# Expose necessary ports
EXPOSE 80 443 3306 6379

View File

@@ -1,6 +1,8 @@
#!/bin/bash
if [[ "$1" == "setup" ]]; then
echo "Updating DNF packages..."
sudo dnf -y update
echo "Setting up UNIT3D..."
sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod -R 750 /var/lib/mysql
@@ -12,7 +14,6 @@ if [[ "$1" == "setup" ]]; then
echo "Setting correct permissions for MariaDB data directory..."
su -s /bin/bash mysql -c "mysqld &"
redis-server --daemonize yes
mkdir -p /run/php-fpm
php-fpm &
# Wait for MariaDB to be ready
@@ -24,7 +25,6 @@ if [[ "$1" == "setup" ]]; then
sudo chown -R unit3d:unit3d /var/www/html /home/unit3d/
su -s /bin/bash unit3d -c "/setup.sh"
tail -f /dev/null
fi
if [[ "$1" == "debug" ]]; then
echo "Debug mode: keeping container running..."
@@ -47,21 +47,27 @@ if [[ "$1" == "backup-mysql" ]]; then
fi
if [[ -z "$1" ]]; then
echo "Starting PHP Artisan server..."
redis-server --daemonize yes
echo "Updating DNF packages..."
sudo dnf -y update
pecl channel-update pecl.php.net
pecl upgrade-all
echo "Starting MySQL..."
sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod -R 750 /var/lib/mysql
sudo chage -E -1 mysql
# Ensure correct ownership for /var/www/html
sudo chown -R unit3d:unit3d /var/www/html
su -s /bin/bash mysql -c "cd '/usr' ; /usr/bin/mariadbd-safe --datadir='/var/lib/mysql'"
su -s /bin/bash mysql -c "mysqld &"
# Wait for MariaDB to be ready
until mysqladmin ping -h "localhost" --silent; do
echo "Waiting for MariaDB to be available..."
sleep 2
done
echo "Starting Redis..."
redis-server --daemonize yes
echo "Starting PHP-FPM..."
php-fpm &
echo "Starting PHP Artisan server..."
su -s /bin/bash unit3d -c "/run.sh"
fi