From 880b5423b70b51a7e4d73ac27759b3e6590574f1 Mon Sep 17 00:00:00 2001 From: sskender Date: Mon, 28 Sep 2020 14:14:58 +0200 Subject: [PATCH] env file updated and automate database creation --- .env | 7 +++++++ docker-compose.yml | 8 +++----- mariadb.env | 2 -- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 .env delete mode 100644 mariadb.env diff --git a/.env b/.env new file mode 100644 index 0000000..482abe1 --- /dev/null +++ b/.env @@ -0,0 +1,7 @@ +# root user +MYSQL_ROOT_PASSWORD=roottoor + +# custom user +MYSQL_USER=sskender +MYSQL_PASSWORD=password123 +MYSQL_DATABASE=mydatabase \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 40f4f0d..829970b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,17 +8,15 @@ services: build: context: ./mariadb dockerfile: Dockerfile - environment: - - MYSQL_ROOT_PASSWORD=rootpassword env_file: - - mariadb.env + - ".env" networks: - intranet ports: - "3306:3306" restart: always volumes: - - mariadb:/var/lib/mysql + - db_data:/var/lib/mysql phpmyadmin: container_name: phpmyadmin @@ -40,4 +38,4 @@ networks: volumes: - mariadb: \ No newline at end of file + db_data: \ No newline at end of file diff --git a/mariadb.env b/mariadb.env deleted file mode 100644 index bd34be4..0000000 --- a/mariadb.env +++ /dev/null @@ -1,2 +0,0 @@ -MYSQL_USER=sskender -MYSQL_PASSWORD=password \ No newline at end of file