From 07021b01f4bd37d1fba78c4e1c07c100fc72d9ce Mon Sep 17 00:00:00 2001 From: James Whiteman Date: Fri, 7 Apr 2017 14:23:02 +1200 Subject: [PATCH 1/4] Delete startup --- mysql/startup | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 mysql/startup diff --git a/mysql/startup b/mysql/startup deleted file mode 100644 index 0a82f1d..0000000 --- a/mysql/startup +++ /dev/null @@ -1,4 +0,0 @@ -DROP USER IF EXISTS 'MYSQL_USER'; -CREATE USER 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD'; -CREATE DATABASE IF NOT EXISTS `MYSQL_DATABASE`; -GRANT ALL ON `MYSQL_DATABASE`.* TO 'MYSQL_USER'@'%'; From 8820501644bdfd7b763ce135b6381590cc7ea212 Mon Sep 17 00:00:00 2001 From: James Whiteman Date: Fri, 7 Apr 2017 14:24:15 +1200 Subject: [PATCH 2/4] Update Dockerfile --- mysql/Dockerfile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/mysql/Dockerfile b/mysql/Dockerfile index b483cc2..e494b65 100644 --- a/mysql/Dockerfile +++ b/mysql/Dockerfile @@ -2,26 +2,10 @@ FROM mysql:5.7 MAINTAINER Mahmoud Zalt -ADD startup /etc/mysql/startup - RUN chown -R mysql:root /var/lib/mysql/ -ARG MYSQL_DATABASE=default -ARG MYSQL_USER=default -ARG MYSQL_PASSWORD=secret -ARG MYSQL_ROOT_PASSWORD=root - -ENV MYSQL_DATABASE=$MYSQL_DATABASE -ENV MYSQL_USER=$MYSQL_USER -ENV MYSQL_PASSWORD=$MYSQL_PASSWORD -ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD - -RUN sed -i 's/MYSQL_DATABASE/'$MYSQL_DATABASE'/g' /etc/mysql/startup && \ - sed -i 's/MYSQL_USER/'$MYSQL_USER'/g' /etc/mysql/startup && \ - sed -i 's/MYSQL_PASSWORD/'$MYSQL_PASSWORD'/g' /etc/mysql/startup - ADD my.cnf /etc/mysql/conf.d/my.cnf -CMD ["mysqld", "--init-file=/etc/mysql/startup"] +CMD ["mysqld"] EXPOSE 3306 From cc50339bcb2025e656fc784ed07b90edada425cf Mon Sep 17 00:00:00 2001 From: James Whiteman Date: Fri, 7 Apr 2017 14:25:40 +1200 Subject: [PATCH 3/4] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7f60f0f..a253404 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -166,7 +166,7 @@ services: mysql: build: context: ./mysql - args: + environment: - MYSQL_DATABASE=${MYSQL_DATABASE} - MYSQL_USER=${MYSQL_USER} - MYSQL_PASSWORD=${MYSQL_PASSWORD} From 64b985f005e919bc95e12d1232a503e833cff5d1 Mon Sep 17 00:00:00 2001 From: James Whiteman Date: Fri, 7 Apr 2017 14:27:15 +1200 Subject: [PATCH 4/4] Update docker-compose.yml --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a253404..ea4a213 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -167,10 +167,10 @@ services: build: context: ./mysql environment: - - MYSQL_DATABASE=${MYSQL_DATABASE} - - MYSQL_USER=${MYSQL_USER} - - MYSQL_PASSWORD=${MYSQL_PASSWORD} - - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} + - MYSQL_DATABASE=${MYSQL_DATABASE} + - MYSQL_USER=${MYSQL_USER} + - MYSQL_PASSWORD=${MYSQL_PASSWORD} + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} volumes: - mysql:/var/lib/mysql ports: