1
0
forked from noxious/server

Updated Dockerfile

This commit is contained in:
2025-02-07 22:57:05 +01:00
parent 5f02aca6e4
commit 8b9afdf956
2 changed files with 31 additions and 7 deletions

View File

@ -5,16 +5,18 @@ RUN apk add --no-cache \
redis \
mariadb \
mariadb-client \
tmux
tmux \
mariadb-server-utils \
mariadb-connector-c
# Create non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
# Setup MariaDB
# Setup MariaDB with proper permissions
RUN mkdir -p /run/mysqld /var/lib/mysql && \
chown -R mysql:mysql /run/mysqld && \
chown -R mysql:mysql /var/lib/mysql && \
mariadb-install-db --user=mysql --datadir=/var/lib/mysql && \
mysql_install_db --user=mysql --datadir=/var/lib/mysql && \
chmod 777 /run/mysqld
WORKDIR /usr/src/app
@ -28,7 +30,11 @@ RUN npm ci --only=production && \
# Grant necessary permissions to appuser
RUN adduser appuser mysql && \
chmod 777 /var/lib/mysql
chmod 755 /var/lib/mysql && \
mkdir -p /var/log/mysql && \
chown -R mysql:mysql /var/log/mysql && \
touch /var/log/mysql/error.log && \
chown mysql:mysql /var/log/mysql/error.log
USER appuser