Sign inSign up

cstadler333/gitlab-ci-php

By cstadler333

•Updated 2 days ago

Build and test PHP applications with Gitlab CI

Image
Integration & delivery
0

9.1K

cstadler333/gitlab-ci-php repository overview

⁠Build and test PHP applications with Gitlab CI

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

Logo


GitHub last commit

Docker Pulls


⁠Based on Official PHP images⁠ and edbizarro's Images⁠

CURRENTLY ONLY ALPINE IMAGES!

All latest versions come with:

Alternative versions available with:


⁠Gitlab pipeline examples

⁠Symfony examples
⁠Simple .gitlab-ci.yml using MariaDB service
variables:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_USER: symfony
    MYSQL_PASSWORD: password
    MYSQL_DATABASE: project
    APP_ENV: prod
    DATABASE_URL: mysql://$MYSQL_USER:$MYSQL_PASSWORD@mysql/$MYSQL_DATABASE

image: cstadler333/gitlab-ci-php:8.3-alpine
services:
    - mariadb:10.11

build:
    stage: build
    before_script:
        - npm install
    script:
        - npm run build
        - composer install --prefer-dist --no-ansi --no-interaction --no-progress
⁠Advanced .gitlab-ci.yml using MariaDB service, stages, templates and cache
stages:
    - build
    - deploy

variables:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_USER: symfony
    MYSQL_PASSWORD: password
    MYSQL_DATABASE: project
    APP_ENV: prod
    DATABASE_URL: mysql://$MYSQL_USER:$MYSQL_PASSWORD@mysql/$MYSQL_DATABASE

cache:
    key: $CI_COMMIT_REF_NAME
    paths:
        - node_modules/
        - vendor/

image: cstadler333/gitlab-ci-php:8.3-alpine
services:
    - mariadb:10.11

.build_template: &build
    stage: build
    before_script:
        - npm install --force
    script:
        - npm run build
        - composer install --prefer-dist --no-ansi --no-interaction --no-progress

.deploy_template: &deploy
    stage: deploy
    before_script:
        - 'which ssh-agent || ( apt-get install -qq openssh-client )'
        - eval $(ssh-agent -s)
        - ssh-add <(echo "$SSH_PRIVATE_KEY")
        - mkdir -p ~/.ssh
        - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

Build Master:
    <<: *build
    only:
        - master

Deploy Master:
    <<: *deploy
    only:
        - master
    script:
        - rsync -a --progress --human-readable --delete
            --exclude .git
            --exclude node_modules
            --exclude var
            --exclude vendor
            .
            user@server:path

⁠Deploying PHP applications with Gitlab

Tag summary

Content type

Image

Digest

sha256:b8f1bde30…

Size

278.4 MB

Last updated

2 days ago

docker pull cstadler333/gitlab-ci-php:8.4-alpine