構成
|- docker-compose.yml |- Dockerfile
docker-compose.yml
version: '3' services: web: build: . ports: - "8080:8080" volumes: - .:/repo depends_on: - db tty: true privileged: true db: image: mysql:5.7 command: mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci ports: - 3306:3306 restart: always environment: MYSQL_ROOT_PASSWORD: root
Dockerfile
FROM centos:7 # update yum RUN yum -y update RUN yum -y install yum-utils RUN yum clean all RUN yum -y install epel-release RUN yum -y groupinstall "Development Tools" RUN yum -y install wget git vim zsh curl # install remi repo RUN wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm RUN rpm -Uvh remi-release-7*.rpm RUN yum-config-manager --enable remi-php70 # install php7 RUN \ yum -y install \ php php-common \ php-mbstring \ php-mcrypt \ php-devel \ php-xml \ php-mysqlnd \ php-pdo \ php-opcache --nogpgcheck \ php-bcmath # application directory RUN mkdir /app WORKDIR /app # install composer RUN curl -sS https://getcomposer.org/installer | php && \ mv composer.phar /usr/local/bin/composer # timezone setting RUN cp /etc/localtime /etc/localtime.org RUN ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime EXPOSE 8080 CMD ["/sbin/init"]