Docker images with everything you'll need to build and test PHP applications.
Based on Official PHP images
PHP 7.4 available
-
7.4
,7
,latest
(7.4/Dockerfile) - -
7.4-alpine
,alpine
(7.4/alpine/Dockerfile) - -
7.4-fpm
,fpm
(7.4/fpm/Dockerfile) - -
7.3
(7.3/Dockerfile) - -
7.3-alpine
(7.3/alpine/Dockerfile) - -
7.3-alpine-lts
,alpine-lts
(7.3/alpine/Dockerfile-lts) - -
7.3-fpm
(7.3/fpm/Dockerfile) - -
7.2
(7.2/Dockerfile) - -
7.2-alpine
(7.2/alpine/Dockerfile) - -
7.2-alpine-lts
(7.2/alpine/Dockerfile-lts) - -
7.2-fpm
(7.2/fpm/Dockerfile) -
All versions come with Node 12, Composer and Yarn
PHP 7.0.x and 7.1.x are now deprecated and removed from this repo since they reach end of life. Your scripts will not stop working since the images are still available but they will not be receiving new builds from now on. For more information please visit https://www.php.net/supported-versions.php
All images come with PHP (with all laravel required extensions), Composer (with hirak/prestissimo to speed up installs), Node and Yarn.
Everything you need to test Laravel projects :D
To run Dusk tests we need chromium installed on the image, because of that we have a special tag for this case.
7.4-chromium
(7.4/chromium/Dockerfile)7.3-chromium
(7.3/chromium/Dockerfile)7.2-chromium
(7.2/chromium/Dockerfile)
Check Dusk example for more details.
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
DB_HOST: mysql
test:
stage: test
services:
- mysql:5.7
image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
script:
- yarn install --pure-lockfile
- composer install --prefer-dist --no-ansi --no-interaction --no-progress
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh --seed
- ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr
stages:
- test
- deploy
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
DB_HOST: mysql
# Speed up builds
cache:
key: $CI_BUILD_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x
paths:
- vendor
- node_modules
- public
- .yarn
test:
stage: test
services:
- mysql:5.7
image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
script:
- yarn config set cache-folder .yarn
- yarn install --pure-lockfile
- composer install --prefer-dist --no-ansi --no-interaction --no-progress
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh --seed
- ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors=never --stderr
artifacts:
paths:
- ./storage/logs # for debugging
expire_in: 7 days
when: always
deploy:
stage: deploy
image: edbizarro/gitlab-ci-pipeline-php:7.4-alpine
script:
- echo "Deploy all the things!"
only:
- master
when: on_success
stages:
- test
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_DATABASE: homestead
DB_HOST: mysql
# Speed up builds
cache:
key: $CI_BUILD_REF_NAME # changed to $CI_COMMIT_REF_NAME in Gitlab 9.x
paths:
- vendor
- node_modules
- public
- .yarn
test:
stage: test
services:
- mysql:5.7
image: edbizarro/gitlab-ci-pipeline-php:7.4-chromium
script:
- yarn config set cache-folder .yarn
- yarn install --pure-lockfile
- composer install --prefer-dist --no-ansi --no-interaction --no-progress
- cp .env.example .env
- php artisan key:generate
- php artisan migrate:refresh --seed
- php artisan serve &
- ./vendor/laravel/dusk/bin/chromedriver-linux --port=9515 &
- sleep 5
- php artisan dusk
artifacts:
paths:
- ./storage/logs # for debugging
- ./tests/Browser/screenshots # for Dusk screenshots
- ./tests/Browser/console
expire_in: 7 days
when: always
Recommended
Special thanks to Ambientum, an incredible Brazilian project, for the inspiration.
Also https://github.com/Chialab/docker-php for php 7.2 build scripts