mkdir docker-handson && cd docker-handson mkdir src laravel
Last active
March 10, 2020 22:26
-
-
Save wantonbe/a817c715b6bb7e0e0eadd985637eceba to your computer and use it in GitHub Desktop.
Dockerハンズオン
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
#!/bin/bash | |
docker run -v `pwd`/src:/src composer create-project --prefer-dist laravel/laravel src/$1 |
chmod +x install.sh; /bin/bash install.sh mylaravel
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.2-apache | |
RUN set -x && \ | |
apt-get -y update && \ | |
apt-get install -y mysql-client net-tools curl zlib1g-dev unzip | |
RUN \ | |
docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd --with-libdir=lib/x86_64-linux-gnu/ \ | |
&& docker-php-ext-configure mysqli --with-mysqli=mysqlnd --with-libdir=lib/x86_64-linux-gnu/ \ | |
&& docker-php-ext-install mysqli \ | |
&& docker-php-ext-install pdo_mysql \ | |
&& docker-php-ext-install zip \ | |
&& pecl install xdebug | |
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | |
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | |
RUN a2enmod rewrite | |
WORKDIR /var/www |
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.1' | |
services: | |
app: | |
build: | |
context: ./laravel | |
volumes: | |
- ./src:/var/www | |
ports: | |
- "8080:80" | |
working_dir: /var/www/mylaravel | |
environment: | |
APACHE_DOCUMENT_ROOT: /var/www/mylaravel/public | |
links: | |
- mysql | |
mysql: | |
image: mysql:5.7 | |
ports: | |
- "3306:3306" | |
environment: | |
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | |
TZ: "Asia/Tokyo" |
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-compose up -d | |
ブラウザでアクセス | |
http://localhost:8080 |
Windows ユーザーの方は pwd
の部分は自分のディレクトリ名に変更してください
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ファイル構成はこうです