initial commit

This commit is contained in:
2024-01-17 16:53:15 +01:00
commit 04b138497b
11 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
FROM debian:buster
RUN apt update -y
RUN apt upgrade -y
RUN apt install mariadb-server -y
RUN apt install procps -y
COPY conf/50-server.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
#moves the config file from conf to the docker container
COPY tools/mariadb.sh /mariadb.sh
#moves the script inside the docker container
RUN chmod +x /mariadb.sh
EXPOSE 3306
ENTRYPOINT ["/bin/bash", "mariadb.sh"]

View File

@@ -0,0 +1,6 @@
[mysqld]
datadir = /var/lib/mysql
socket = /run/mysqld/mysqld.sock
bind_address = *
port = 3306
user = mysql

View File

@@ -0,0 +1,15 @@
#!/bin/sh
service mysql start
echo "CREATE USER IF NOT EXISTS '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_USER';" | mysql
echo "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" | mysql
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '$MYSQL_ROOT_PASSWORD';" | mysql
echo "FLUSH PRIVILEGES;" | mysql
echo "CREATE DATABASE IF NOT EXISTS $MYSQL_DATABASE;" | mysql
sleep 2
service mysql stop
exec mysqld_safe