initial commit
This commit is contained in:
18
srcs/requirements/mariadb/Dockerfile
Normal file
18
srcs/requirements/mariadb/Dockerfile
Normal 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"]
|
||||
6
srcs/requirements/mariadb/conf/50-server.cnf
Normal file
6
srcs/requirements/mariadb/conf/50-server.cnf
Normal file
@@ -0,0 +1,6 @@
|
||||
[mysqld]
|
||||
datadir = /var/lib/mysql
|
||||
socket = /run/mysqld/mysqld.sock
|
||||
bind_address = *
|
||||
port = 3306
|
||||
user = mysql
|
||||
15
srcs/requirements/mariadb/tools/mariadb.sh
Normal file
15
srcs/requirements/mariadb/tools/mariadb.sh
Normal 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
|
||||
Reference in New Issue
Block a user