Laravel
28
Вклад в тег
# php/Dockerfile
FROM php:7-fpm:latest
MAINTAINER Vasya Pupkin
# Ставим, например, composer.
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
php:
build:
context: ./php
dockerfile: Dockerfile
image: my-php
volumes:
- ./www:/www
- ./php/log.conf:/usr/local/etc/php-fpm.d/zz-log.conf
networks:
- code-network
docker-compose exec my-php bash
composer --version
docker-compose exec my-php composer --version
docker-compose run --rm my-php composer --version
#!/usr/bin/env bash
COMPOSE="docker-compose"
if [ $# -gt 0 ]; then
if [ "$1" == "composer" ]; then
shift 1
$COMPOSE run --rm \
-w /www \
my-php \
composer "$@"
# If "test" is used, run unit tests,
# pass-thru any extra arguments to php-unit
elif [ "$1" == "test" ]; then
shift 1
$COMPOSE run --rm \
-w /www \
my-php \
./vendor/bin/phpunit "$@"
# If "npm" is used, run npm
# from our node container
elif [ "$1" == "npm" ]; then
shift 1
$COMPOSE run --rm $TTY \
-w /var/www/html \
node \
npm "$@"
else
$COMPOSE "$@"
fi
else
$COMPOSE ps
fi
./dev.sh # docker-compose ps
./dev.sh logs my-php # docker-compose logs my-php
./dev.sh composer --version # выполнение любой composer команды
./dev.sh npm --version # выполнение любой npm команды
./dev.sh test --filter some_test_method # запуск phpunit тестов