Skip to content

Instantly share code, notes, and snippets.

@andypost
Last active August 8, 2022 05:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andypost/0c5b0fe679b9d036df3d45af18997087 to your computer and use it in GitHub Desktop.
Save andypost/0c5b0fe679b9d036df3d45af18997087 to your computer and use it in GitHub Desktop.
Drupal 8 template for core dev + chromium
version: "2.1"
services:
php:
image: skilldlabs/php:8-fpm
container_name: core8
restart: always
working_dir: /var/www/html/web
volumes:
- .:/var/www/html/web:z
- /home/andypost/.composer:/home/www-data/.composer:z
# - ./db/tideways_xhprof.ini:/etc/php7/conf.d/tideways_xhprof.ini:z
# - ./db/tideways_xhprof.so.master:/usr/lib/php7/modules/tideways_xhprof.so:z
# - ./db/xhprof.ini:/etc/php7/conf.d/xhprof.ini:z
# - ./db/xhprof.so:/usr/lib/php7/modules/xhprof.so:z
# Uncomment next line if you need PHP Xdebug.
# command: php-fpm7 -F -e -d rlimit_core=unlimited -d zend_extension=xdebug.so
environment:
# MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", null, "http://chrome:4444/wd/hub"]'
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:4444"]'
networks:
- front
nginx:
image: skilldlabs/nginx:1.14
container_name: "core8_nginx"
restart: always
depends_on:
- php
volumes_from:
- php
networks:
- front
# logging:
# driver: "journald"
# options:
# tag: "{{.Name}}"
chrome:
image: drupalci/webdriver-chromedriver:production
ulimits:
core:
soft: -1
hard: -1
cap_add:
- SYS_ADMIN
volumes:
- /dev/shm:/dev/shm
ports:
- "4444:4444"
entrypoint:
- chromedriver
- "--port=4444"
- "--no-sandbox"
# - "--log-path=/tmp/chromedriver.log"
- "--log-level=INFO"
# - "--verbose"
- "--whitelisted-ips="
networks:
- front
networks:
front:
driver: bridge
@andypost
Copy link
Author

andypost commented Aug 16, 2019

And current Makefile

.PHONY: up upx log down exec exec0 t

CUID := $(shell id -u)
CGID := $(shell id -g)
IMAGEPHP := skilldlabs/php:73

all: | exec

upd:
	docker-compose up -d php nginx

stop:
	docker-compose stop

up1:
	docker run --rm --name core8 \
		-u $(CUID):$(CGID) \
		-v $(shell pwd):/srv \
		-v $(HOME)/.cache/composer:/mnt \
		-e COMPOSER_HOME=/mnt \
		-p 8080:8080 -d \
		$(IMAGEPHP) php -S 0.0.0.0:8080 \
		.ht.router.php
	docker exec -u 0:0 core8 adduser -D www

upx:
	docker run --rm --name core8 \
		-u $(CUID):$(CGID) \
		-v $(shell pwd):/srv \
		-p 8080:8080 \
		$(IMAGEPHP) php -d zend_extension=xdebug.so -d xdebug.profiler_output_dir=/tmp -S 0.0.0.0:8080 \
		.ht.router.php
	docker exec core8 adduser -D www

h:
	docker exec -u $(CUID):$(CGID) core8 composer global require -o --update-no-dev --no-suggest "hirak/prestissimo:^0.3"

log:
	docker logs -f --tail=10 core8

down:
	docker stop core8

exec:
	docker exec -it -u $(CUID):$(CGID) core8 ash

exec0:
	docker exec -it -u 0:0 core8 ash

t:
	docker exec \
	-u $(CUID):$(CGID) \
	-e SIMPLETEST_BASE_URL=http://nginx \
	-e SIMPLETEST_DB=sqlite://./db/tests.db \
	-e BROWSERTEST_OUTPUT_DIRECTORY=./sites/simpletest/out \
	core8 vendor/bin/phpunit -c core/phpunit.xml.dist --colors=always \
	--printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" --debug -v \
	${t}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment