Dockerコンテナ内にXdebugを導入 (#33)
* コンテナにxdebugをインストール * env fileをDockerに読ませるようにした * 環境変数 APP_DEBUG に応じてXdebugをロードしてApacheを起動するようにした * シェルスクリプトのWindows対策 (.gitattribute)
This commit is contained in:
parent
0d4a61ef15
commit
2ca6c4c60d
12
.env.example
12
.env.example
@ -5,12 +5,12 @@ APP_DEBUG=true
|
|||||||
APP_LOG_LEVEL=debug
|
APP_LOG_LEVEL=debug
|
||||||
APP_URL=http://localhost
|
APP_URL=http://localhost
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=pgsql
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=db
|
||||||
DB_PORT=3306
|
DB_PORT=5432
|
||||||
DB_DATABASE=homestead
|
DB_DATABASE=tissue
|
||||||
DB_USERNAME=homestead
|
DB_USERNAME=tissue
|
||||||
DB_PASSWORD=secret
|
DB_PASSWORD=tissue
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
BROADCAST_DRIVER=log
|
||||||
CACHE_DRIVER=file
|
CACHE_DRIVER=file
|
||||||
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3,3 +3,4 @@
|
|||||||
*.scss linguist-vendored
|
*.scss linguist-vendored
|
||||||
*.js linguist-vendored
|
*.js linguist-vendored
|
||||||
CHANGELOG.md export-ignore
|
CHANGELOG.md export-ignore
|
||||||
|
*.sh text eol=lf
|
@ -5,10 +5,17 @@ ENV APACHE_DOCUMENT_ROOT /var/www/html/public
|
|||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y git libpq-dev unzip \
|
&& apt-get install -y git libpq-dev unzip \
|
||||||
&& docker-php-ext-install pdo_pgsql \
|
&& docker-php-ext-install pdo_pgsql \
|
||||||
|
&& pecl install xdebug \
|
||||||
&& curl -sS https://getcomposer.org/installer | php \
|
&& curl -sS https://getcomposer.org/installer | php \
|
||||||
&& mv composer.phar /usr/local/bin/composer \
|
&& mv composer.phar /usr/local/bin/composer \
|
||||||
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
|
||||||
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
|
&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf \
|
||||||
&& a2enmod rewrite
|
&& a2enmod rewrite
|
||||||
|
|
||||||
|
COPY dist/bin /usr/local/bin/
|
||||||
|
COPY dist/php.d /usr/local/etc/php/php.d/
|
||||||
|
|
||||||
|
ENTRYPOINT ["tissue-entrypoint.sh"]
|
||||||
|
CMD ["apache2-foreground"]
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
8
dist/bin/tissue-entrypoint.sh
vendored
Normal file
8
dist/bin/tissue-entrypoint.sh
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ "$APP_DEBUG" == "true" ]]; then
|
||||||
|
export PHP_INI_SCAN_DIR=":/usr/local/etc/php/php.d"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec docker-php-entrypoint "$@"
|
5
dist/php.d/99-xdebug.ini
vendored
Normal file
5
dist/php.d/99-xdebug.ini
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
; Dockerでのデバッグ用設定
|
||||||
|
zend_extension=xdebug.so
|
||||||
|
xdebug.remote_enable=true
|
||||||
|
xdebug.remote_autostart=true
|
||||||
|
xdebug.remote_host=host.docker.internal
|
@ -3,13 +3,8 @@ version: "3"
|
|||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
environment:
|
env_file:
|
||||||
DB_CONNECTION: pgsql
|
- .env
|
||||||
DB_HOST: db
|
|
||||||
DB_PORT: 5432
|
|
||||||
DB_DATABASE: tissue
|
|
||||||
DB_USERNAME: tissue
|
|
||||||
DB_PASSWORD: tissue
|
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www/html
|
- .:/var/www/html
|
||||||
networks:
|
networks:
|
||||||
|
Loading…
Reference in New Issue
Block a user