Skip to content

Commit

Permalink
修改base环境
Browse files Browse the repository at this point in the history
  • Loading branch information
0xs1riu5 committed Sep 30, 2018
1 parent 8730719 commit 7c89cd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions base/lnmpsingle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ RUN groupadd awd \
&& chown awd:awd -R /opt/mysql /www \
&& cd /opt/mysql/bin \
&& ./mysqld --initialize-insecure --user=awd --basedir=/opt/mysql --datadir=/opt/mysql/data \
&& ln -s /opt/mysql/bin/* /usr/local/bin/ \
&& echo "[mysqld]\nuser = awd\nsecure-file-priv = \"\"" > /etc/my.cnf \
&& cp ../support-files/mysql.server /etc/init.d/mysql \
&& chmod 755 /etc/init.d/mysql \
&& /etc/init.d/mysql start \
&& echo "GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'shadow' WITH GRANT OPTION;Delete FROM mysql.user Where User='root' and Host='localhost'; FLUSH PRIVILEGES" | mysql \
&& /etc/init.d/mysql stop \
&& wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz -P /tmp \
&& tar -zxvf /tmp/pcre-8.40.tar.gz -C /tmp \
&& cd /tmp/pcre-8.40 \
Expand All @@ -40,16 +47,15 @@ RUN groupadd awd \
&& sed -i "s/^;date.timezone =$/date.timezone = \"Asia\/Shanghai\"/" /usr/local/php/etc/php.ini \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& ln -s /opt/mysql/bin/* /usr/local/bin/ \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shangha" > /etc/timezone \
&& cd /opt/mysql \
&& chmod -R 777 data \
&& cd /tmp \
&& rm -rf * \
&& chmod a+x /usr/local/bin/docker-entrypoint.sh \
&& ln -s /usr/local/bin/docker-entrypoint.sh /entrypoint.sh
&& chmod a+x /usr/local/bin/docker-entrypoint.sh


ENTRYPOINT ["docker-entrypoint.sh"]

9 changes: 5 additions & 4 deletions base/lnmpsingle/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ set -e
/usr/local/php/sbin/php-fpm
cd /opt/mysql/data
chmod -R 777 *
/opt/mysql/bin/mysqld_safe --user=awd --secure-file-priv='' --general-log-file="/opt/mysql/mysql-sql.log" &
sleep 5s

/etc/init.d/mysql start
#/opt/mysql/bin/mysqld_safe --user=awd --secure-file-priv='' --general-log-file="/opt/mysql/mysql-sql.log" &
sleep 5s
for f in /docker-entrypoint-initdb.d/*; do
case "$f" in
*.sh) echo "[Entrypoint] running $f"; . "$f" ;;
*.sql) echo "[Entrypoint] running $f"; mysql < "$f" && echo ;;
*.sql) echo "[Entrypoint] running $f"; mysql -u root -pshadow < "$f" && echo ;;
*) echo "[Entrypoint] ignoring $f" ;;
esac
echo
done

echo "GRANT ALL ON *.* TO root@'%' IDENTIFIED BY 'shadow' WITH GRANT OPTION;Delete FROM mysql.user Where User='root' and Host='localhost'; FLUSH PRIVILEGES" | mysql
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
/usr/bin/supervisord --nodaemon -c /etc/supervisor/supervisord.conf

0 comments on commit 7c89cd8

Please sign in to comment.