Merge pull request #758 from hounded/master

MySQL fix
This commit is contained in:
Mahmoud Zalt 2017-04-07 11:27:32 -04:00 committed by GitHub
commit 6e1911bdd5
3 changed files with 6 additions and 26 deletions

View File

@ -166,11 +166,11 @@ services:
mysql:
build:
context: ./mysql
args:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
volumes:
- mysql:/var/lib/mysql
ports:

View File

@ -2,26 +2,10 @@ FROM mysql:5.7
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
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

View File

@ -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'@'%';