Added mariadb

This commit is contained in:
eroncero
2025-08-04 11:43:29 +02:00
parent 8eec361aa7
commit 3d04ad8b25
5 changed files with 46 additions and 1 deletions

4
.gitignore vendored
View File

@@ -4,4 +4,8 @@ nginx-srv/var
multi-php-fpm/etc
multi-php-fpm/run
mariadb-srv/run
mariadb-srv/var
mariadb-srv/etc
#

View File

@@ -13,7 +13,7 @@ services:
volumes:
- ./nginx-srv/etc/nginx/sites-available:/etc/nginx/sites-available
- ./nginx-srv/var/www:/var/www
- ./multi-php-fpm/run/php:/run/php # It will be mounted from the PHP container.
- ./multi-php-fpm/run/php:/run/php # Socket files dir. It will be mounted and shared from the PHP container.
- ./nginx-srv/etc/letsencrypt:/etc/letsencrypt
multi-php-fpm:
@@ -24,3 +24,12 @@ services:
volumes:
- ./multi-php-fpm/etc/php:/etc/php
- ./multi-php-fpm/run/php:/run/php
- ./mariadb-srv/run/mysql:/run/mysqld
mariadb-srv:
image: eroncero/mariadb-srv:latest
restart: unless-stopped
volumes:
- ./mariadb-srv/var/lib/mysql:/var/lib/mysql
- ./mariadb-srv/etc/mysql:/etc/mysql
- ./mariadb-srv/run/mysql/:/run/mysqld

13
mariadb-srv/Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y; apt-get install mariadb-server mariadb-client -y
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
COPY project/entrypoint/fix_volumes.sh /entrypoint/fix_volumes.sh
#COPY project/entrypoint/gen-cert.sh /entrypoint/gen-cert.sh
RUN mkdir -p /tmp/buildtime/etc/mysql && cp -r /etc/mysql/. /tmp/buildtime/etc/mysql/
RUN mkdir -p /tmp/buildtime/var/lib/mysql && cp -r /var/lib/mysql/. /tmp/buildtime/var/lib/mysql/
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]

View File

@@ -0,0 +1,10 @@
#!/bin/sh
/bin/sh /entrypoint/fix_volumes.sh
service mariadb start
# Run the CMD that was passed (or default)
#exec "$@"
tail -f /dev/null

View File

@@ -0,0 +1,9 @@
#!/bin/sh
mkdir -p /etc/mysql # Creates /etc/php if it doesn't exist
mkdir -p /var/lib/mysql # Creates /etc/php if it doesn't exist
mv /tmp/buildtime/etc/mysql/* /etc/mysql/
mv /tmp/buildtime/var/lib/mysql/* /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:root /run/mysqld