☕️ Docker images for build and test PHP applications with Gitlab CI (or any other CI plataform!)
Branch: master
Clone or download
Latest commit 7c31dc0 Feb 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
php labels Feb 9, 2019
.dive-ci tests with dive Feb 8, 2019
.dockerignore improv Sep 14, 2018
.editorconfig editorconfig Feb 20, 2017
.gitignore change php 7.1 to official image Feb 21, 2017
.gitlab-ci-old.yml test another build strategy Jun 28, 2018
.gitlab-ci.yml labels Feb 9, 2019
LICENSE Create LICENSE (#38) May 7, 2018
Makefile remove build for php 7.0 Jan 15, 2019
README.md readme Feb 9, 2019
gitlab-ci-pipeline-php.png readme Feb 20, 2017
goss-7.2-lts.yaml update node Feb 7, 2019
goss-7.2.yaml update node Feb 7, 2019
goss-lts.yaml update node Feb 7, 2019
goss.yaml fix image tests Dec 21, 2018

README.md

Build and test PHP applications with Gitlab CI (or any other CI plataform!

Docker images with everything you'll need to build and test PHP applications.

Logo


Based on Official PHP images

All versions (except lts) come with Node 11, Composer and Yarn

lts version come with node v10

PHP 7.0.x is now deprecated and removed from this documentation. Your scripts will not stop working since the images are still available but they will not be receiving new builds from now on.

Docker Pulls


Laravel users

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


Gitlab pipeline examples

Laravel test examples

Simple .gitlab-ci.yml using mysql service

# 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.2-alpine
  script:
    - yarn
    - 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

Advanced .gitlab-ci.yml using mysql service, stages and cache

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.2-alpine
  script:
    - sudo 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: 1 days
    when: always

deploy:
  stage: deploy
  image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine
  script:
    - echo "Deploy all the things!"
  only:
    - master
  when: on_success

Deploying Laravel applications with Gitlab

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

forthebadge forthebadge