-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Takuya Iwamoto
authored and
Takuya Iwamoto
committed
Nov 3, 2017
1 parent
ed2321d
commit 62294f2
Showing
5 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
FROM centos:6.9 | ||
MAINTAINER Takuya Iwamoto <[email protected]> | ||
|
||
# Settings | ||
RUN sed -i '/^ZONE/d' /etc/sysconfig/clock | ||
RUN sed -i '/^UTC/d' /etc/sysconfig/clock | ||
RUN echo 'ZONE="Asia/Tokyo"' >> /etc/sysconfig/clock | ||
RUN echo 'UTC="false"' >> /etc/sysconfig/clock | ||
RUN cp -p /usr/share/zoneinfo/Asia/Tokyo /etc/localtime | ||
|
||
# yum update | ||
RUN yum -y update | ||
RUN yum clean all | ||
RUN yum history sync | ||
|
||
# install groupinstall & Settings | ||
RUN yum -y groupinstall "Japanese Support" | ||
RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8 | ||
RUN echo 'LANG="ja_JP.UTF-8"' > /etc/sysconfig/i18n | ||
|
||
# install epel | ||
#RUN ls -lt /etc/yum.repos.d | ||
#RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | ||
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm | ||
RUN rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm | ||
#RUN ls -lt /etc/yum.repos.d | ||
|
||
# install httpd | ||
RUN yum -y install httpd vim-enhanced bash-completion unzip | ||
|
||
# Add my.cnf | ||
ADD my.cnf /etc/my.cnf | ||
|
||
# install mysql | ||
#RUN yum remove mysql* | ||
RUN yum install -y http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm | ||
RUN yum install -y mysql mysql-devel mysql-server mysql-utilities | ||
#RUN echo "NETWORKING=yes" > /etc/sysconfig/network | ||
ENV MYSQL_ROOT_PASSWORD 'password' | ||
COPY docker-entrypoint.sh /entrypoint.sh | ||
RUN chmod 700 /entrypoint.sh | ||
|
||
# start mysqld to create initial tables | ||
#RUN service mysqld start | ||
|
||
# install php | ||
# PHP7.1 | ||
RUN yum remove php-* | ||
#RUN yum install --enablerepo=remi,remi-php71 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt | ||
RUN yum install -y --enablerepo=remi,remi-php71 php php-devel php-mbstring php-pdo php-gd php-mysql php-pear \ | ||
&& sed -ri "s/;date.timezone =/date.timezone = Asia\/Tokyo/g" /etc/php.ini \ | ||
&& echo '<?php phpinfo();' > /var/www/html/info.php | ||
|
||
# iinstall pip | ||
RUN yum install -y python-pip && pip install pip --upgrade | ||
|
||
# install sshd | ||
RUN yum install -y openssh-server openssh-clients passwd | ||
|
||
RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key && ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key | ||
RUN sed -ri 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config && echo 'root:changeme' | chpasswd | ||
|
||
WORKDIR /var/www/html | ||
VOLUME /var/www/html | ||
VOLUME /var/conf | ||
|
||
# ADD httpd.conf /etc/httpd/conf/httpd.conf | ||
|
||
# supervisor | ||
RUN yum install -y supervisor | ||
COPY ./supervisord.conf /etc/supervisord.conf | ||
|
||
EXPOSE 3306 80 | ||
CMD ["/usr/bin/supervisord", "-n"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# centos-php7-lamp | ||
This is docker image for LAMP. | ||
* CentOS 6.9 | ||
* MySQL 5.6.38 | ||
* PHP 7.1.11 | ||
* Apache 2.2.15 | ||
|
||
## Build | ||
|
||
``` | ||
$ cd centos-php7-lamp | ||
$ sudo docker build -t gremito/lamp . | ||
``` | ||
|
||
## Run | ||
|
||
``` | ||
$ sudo docker run -d -p 80:80 gremito/lamp | ||
``` | ||
|
||
## exec | ||
|
||
``` | ||
$ sudo docker exec -it コンテナ名 /bin/bash | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mysql_install_db --user=root --datadir=/var/lib/mysql | ||
|
||
TEMP_FILE='/tmp/mysql-first-time.sql' | ||
cat > "$TEMP_FILE" <<-EOSQL | ||
DELETE FROM mysql.user ; | ||
CREATE USER 'root'@'%' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}' ; | ||
GRANT ALL ON *.* TO 'root'@'%' WITH GRANT OPTION ; | ||
DROP DATABASE IF EXISTS test ; | ||
FLUSH PRIVILEGES ; | ||
EOSQL | ||
|
||
set -- "$@" --init-file="$TEMP_FILE" | ||
|
||
chown -R mysql:mysql /var/lib/mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[client] | ||
default-character-set=utf8 | ||
|
||
[mysqld] | ||
character-set-server=utf8 | ||
explicit_defaults_for_timestamp = 1 | ||
slow_query_log=1 | ||
slow_query_log_file=/var/log/mysql/slow_query.log | ||
long_query_time=0.1 | ||
|
||
[mysqld_safe] | ||
log-error=/var/log/mysql/mysqld.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:mysqld] | ||
command=/sbin/service mysqld start | ||
|
||
[program:httpd] | ||
command=/sbin/service httpd start |