Skip to content

Instantly share code, notes, and snippets.

@okumud
Last active Oct 2, 2017
Embed
What would you like to do?
Documentation for the stackoverflow

Overview

This document for stackoverflow question

History

  1. Inital commit
  2. Change for play-with-docker
  3. Reconfigure for play-with-docker that is not support 3.3
  4. Fix stackoverflow question

Play-with-docker

# make environment from gist.... this is avoid that gist is not allowed makeing directory
git clone https://gist.github.com/okumud/edb89102f18b1dd4d0589d3ba0498bc4 work
cd work
mkdir docker-image
mv Dockerfile ./docker-image

# go docker
docker-compose up --build -d

# destroy, press y
docker-compose stop && docker-compose rm -v

# check on host 
docker-compose run cakephp.web /bin/bash
version: '3.2'
#volumes:
# mysql.db.volume:
services:
mysql.db:
restart: always
image: mysql:5.7.19
container_name: mysql.db
command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci
# volumes:
# - mysql.db.volume:/var/lib/mysql
environment:
MYSQL_DATABASE: 'hoge_db'
MYSQL_USER : 'hoge'
MYSQL_PASSWORD: 'hoge'
MYSQL_ROOT_PASSWORD: 'password'
TZ: "Asia/Tokyo"
ports:
- '33306:3306'
cakephp.web:
container_name: cakephp.web
build: ./docker-image
privileged: true
ports:
- '8001:80'
- '2223:22'
depends_on:
- mysql.db
links:
- mysql.db
FROM centos:7
#time setting
RUN \cp -fp /usr/share/zoneinfo/Japan /etc/localtime
#prepare
RUN yum install -y unzip
# Add yum repositories. (epel and remi)
RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
RUN yum install -y epel-release
RUN yum update -y epel-release
#php7 install
#RUN yum install -y --enablerepo=remi-php71,epel php php-cli php-common php-devel php-fpm php-gd php-gmp php-intl php-mbstring php-mcrypt php-mysql php-opcache php-pdo php-pear-MDB2-Driver-mysqli php-pecl-memcached php-pecl-msgpack php-pecl-xdebug php-phpunit-PHPUnit php-xml
RUN yum install -y --enablerepo=remi-php71,epel php php-cli php-common php-devel php-fpm php-gd php-gmp php-intl php-mbstring php-mcrypt php-mysql php-opcache php-pdo php-pecl-memcached php-pecl-msgpack php-pecl-xdebug php-phpunit-PHPUnit php-xml
#composer install
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
#git install
RUN yum install -y git
#cakephp install
RUN cd /var \
&& composer create-project --prefer-dist -n cakephp/app /var/web_app
RUN ln -s /var/phm_app/webroot /var/www/html/phm
#COPY var/cakephp/webroot/.htaccess /var/phm_app/webroot/.htaccess
#plugin install
RUN cd /var/web_app \
&& composer require muffin/trash \
&& composer require ceeram/cakephp-blame
#httpd install
RUN yum install -y httpd
RUN yum install -y httpd-devel
#COPY etc/httpd/conf.d/phm.conf /etc/httpd/conf.d/phm.conf
#ssh install
RUN yum install -y openssh-server
RUN passwd -d root
#COPY etc/sshd_config /etc/ssh/sshd_config
#service service entry
RUN systemctl enable httpd
RUN systemctl enable sshd
#post processing
VOLUME ["/var/www/html"]
CMD ["/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment