Created
August 4, 2019 15:26
-
-
Save sugumura/41d05eaddffbfd02c067e5478a386628 to your computer and use it in GitHub Desktop.
「オトナのDocker入門#LAMP環境を作ろう」のサンプル
This file contains hidden or 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
version: '3.7' | |
services: | |
db: | |
image: mysql:8.0.17 | |
restart: always | |
command: --default-authentication-plugin=mysql_native_password | |
environment: | |
- MYSQL_ROOT_PASSWORD=password | |
- MYSQL_DATABASE=sample | |
- TZ='Asia/Tokyo' | |
ports: | |
- 3306:3306 | |
adminer: | |
image: adminer | |
restart: always | |
ports: | |
- 8080:8080 |
This file contains hidden or 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
# Docker Volumeに置き換える | |
version: '3.7' | |
services: | |
db: | |
image: mysql:8.0.17 | |
restart: always | |
command: --default-authentication-plugin=mysql_native_password | |
environment: | |
- MYSQL_ROOT_PASSWORD=password | |
- MYSQL_DATABASE=sample | |
- TZ='Asia/Tokyo' | |
ports: | |
- 3306:3306 | |
volumes: | |
- data:/var/lib/mysql | |
adminer: | |
image: adminer | |
restart: always | |
ports: | |
- 8080:8080 | |
volumes: | |
data: |
This file contains hidden or 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
# my.cnfを配置 | |
version: '3.7' | |
services: | |
db: | |
image: mysql:8.0.17 | |
restart: always | |
environment: | |
- MYSQL_ROOT_PASSWORD=password | |
- MYSQL_DATABASE=sample | |
- TZ='Asia/Tokyo' | |
ports: | |
- 3306:3306 | |
volumes: | |
- ./docker/db/conf.d/my.cnf:/etc/mysql/conf.d/my.cnf | |
- data:/var/lib/mysql | |
adminer: | |
image: adminer | |
restart: always | |
ports: | |
- 8080:8080 | |
volumes: | |
data: |
This file contains hidden or 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
# services:web:を追加 | |
# Dockerfile.step1 | |
version: '3.7' | |
services: | |
web: | |
build: | |
context: . | |
dockerfile: ./docker/web/Dockerfile | |
ports: | |
- 8000:80 | |
volumes: | |
- .:/var/www/html | |
db: | |
image: mysql:8.0.17 | |
restart: always | |
environment: | |
- MYSQL_ROOT_PASSWORD=password | |
- MYSQL_DATABASE=sample | |
- TZ='Asia/Tokyo' | |
ports: | |
- 3306:3306 | |
volumes: | |
- ./docker/db/conf.d/my.cnf:/etc/mysql/conf.d/my.cnf | |
- data:/var/lib/mysql | |
adminer: | |
image: adminer | |
restart: always | |
ports: | |
- 8080:8080 | |
volumes: | |
data: |
This file contains hidden or 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
FROM php:7.3.8-apache-stretch | |
EXPOSE 80 |
This file contains hidden or 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
# パッケージを追加 | |
FROM php:7.3.8-apache-stretch | |
# nodeとnpmのインストール | |
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
# composerのインストール | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
# composerで必要なものとmysql、gd利用のためのパッケージ | |
RUN apt-get update \ | |
&& apt-get install -y \ | |
git \ | |
gnupg \ | |
unzip \ | |
nodejs \ | |
libfreetype6-dev \ | |
libjpeg62-turbo-dev \ | |
libpng-dev \ | |
&& docker-php-ext-install \ | |
pdo_mysql \ | |
mysqli \ | |
mbstring \ | |
&& docker-php-ext-install -j$(nproc) iconv \ | |
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
&& docker-php-ext-install -j$(nproc) gd \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& a2enmod \ | |
rewrite | |
EXPOSE 80 |
This file contains hidden or 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
FROM php:7.3.8-apache-stretch | |
# nodeとnpmのインストール | |
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - | |
# composerのインストール | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
# composerで必要なものとmysql、gd利用のためのパッケージ | |
RUN apt-get update \ | |
&& apt-get install -y \ | |
git \ | |
gnupg \ | |
unzip \ | |
nodejs \ | |
libfreetype6-dev \ | |
libjpeg62-turbo-dev \ | |
libpng-dev \ | |
&& docker-php-ext-install \ | |
pdo_mysql \ | |
mysqli \ | |
mbstring \ | |
&& docker-php-ext-install -j$(nproc) iconv \ | |
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | |
&& docker-php-ext-install -j$(nproc) gd \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& a2enmod \ | |
rewrite | |
COPY ./docker/web/php/php.ini /usr/local/etc/php/ | |
COPY ./docker/web/sites-enabled/*.conf /etc/apache2/sites-enabled/ | |
WORKDIR /var/www/html | |
EXPOSE 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment