Skip to content

Commit

Permalink
2019-05-06 AC: Release-1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewscaya committed May 7, 2019
2 parents 72dd6be + cdd8430 commit 1baa7ae
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,33 @@ https://linuxforphp.net

[![Build Status](https://travis-ci.org/linuxforphp/docker-gitlab-ci.svg?branch=master)](https://travis-ci.org/linuxforphp/docker-gitlab-ci)

This repository contains a set of utilities for running PHP tests via [Gitlab CI](https://about.gitlab.com/gitlab-ci/).
This repository contains a set of utilities for running PHP tests via [GitLab CI](https://about.gitlab.com/gitlab-ci/).

These tools provide:

1. [Gitlab runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner) deployment script for Ubuntu on VM or metal server. It is not recommended to install runner right on the production system.
1. [GitLab Runner](https://gitlab.com/gitlab-org/gitlab-ci-multi-runner) deployment script for Ubuntu on VM or metal server. It is not recommended to install runner right on the production system.

2. Set of Docker images for PHP 5.6 - 7.3 based on official Linux for PHP Docker images, with all essential PHP modules. The images also include Node.js.

The goal of these tools is to automate as much as possible of routine work related to configuring the runner so you can concentrate on writing tests for your code.
The goal of these tools is to automate as much as possible the routine work that is related to configuring the GitLab Runner, so you can concentrate on writing tests for your code.
Also these tools are trying to be resource savvy, since in most cases, huge in-RAM caches are not needed for only running unit tests with some fixtures. So, very small VMs can be suitable for running tests.

## Contents of repository
- [Gitlab-runner bootstrap script](https://github.com/linuxforphp/docker-gitlab-ci/tree/master/gitlab-runner-vm) for deploying gitlab-runner.
- [gitlab-runner bootstrap script](https://github.com/linuxforphp/docker-gitlab-ci/tree/master/gitlab-runner-vm) for deploying GitLab Runner.
- [PHP Docker images](https://github.com/linuxforphp/docker-gitlab-ci/tree/master/php) - based on official Linux for PHP images, including all major modules and extensions. Also, PHP 5.6 is available.
- [Example projects](https://github.com/linuxforphp/docker-gitlab-ci/tree/master/examples) - Example PHP test script.

## Quick start

1. Install [Gitlab](https://about.gitlab.com/)
1. Get a server (VM or metal) with minimal Ubuntu-14.04 installed. It will be used for the runner.
1. Login as root to a server and execute `curl -S https://raw.githubusercontent.com/linuxforphp/docker-gitlab-ci/master/gitlab-runner-vm/bootstrap.sh | bash` and answer the questions. This script will install Docker, the Gitlab Runner, and configure the Runner for using these Docker images.
1. Install [GitLab](https://about.gitlab.com/),
2. Get a server (VM or metal) with minimal Ubuntu-14.04 installed. It will be used for the runner.
3. Login as root to a server and execute `curl -S https://raw.githubusercontent.com/linuxforphp/docker-gitlab-ci/master/gitlab-runner-vm/bootstrap.sh | bash` and answer the questions. This script will install Docker, the Gitlab Runner, and configure the Runner for using these Docker images.

Runner is limited to `asclinux/linuxforphp-8.1-ultimate:*` images for main container (where your repository is cloned) and any service images `*/*` (secondary containers that are spun up for services, like mysql, redis, etc)
Runner is limited to `asclinux/linuxforphp-8.1-ultimate:*` images for main container (where your repository is cloned) and any service images `*/*` (secondary containers that are spun up for services, like MySQL, Redis, etc).

If you want to use the server for also running other images (`ruby` or whatever), you should add other runners to `/etc/gitlab-runner/config.toml`, and DO NOT overwrite `allowed_images = ["asclinux/linuxforphp-8.1-ultimate:*"]` for this runner, since it is a potential security breach.
If you want to use the server for also running other images (`ruby` or whatever), you can add other runners to `/etc/gitlab-runner/config.toml`. Please DO NOT overwrite `allowed_images = ["asclinux/linuxforphp-8.1-ultimate:*"]` for this runner, since it is a potential security breach.

Moreover, many services and languages are already available from within the **Linux for PHP** Docker images. Thus, by adding the appropriate `RUN` commands in the container's `Dockerfile`, one can launch all the needed services to quickly run a set of tests (Ruby, Python, Java, Node.js, Mongo server, Redis server, PostgreSQL server, etc.).

## Requirements
- Gitlab v`9.0` and later
Expand Down
44 changes: 20 additions & 24 deletions php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,32 @@ https://linuxforphp.net

[CHANGELOG](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/CHANGELOG.md)

**Linux for PHP** Docker images for continuous integration and running tests. These images can be used with Gitlab CI,
**Linux for PHP** Docker images for continuous integration and running tests. These images can be used with GitLab CI,
or any automated testing system or as standalone services.

# Supported tags and respective `Dockerfile` links

- [`5.6-nts`, (*5.6/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/5.6/Dockerfile)
- [`7.0-nts`, (*7.0/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.0/Dockerfile)
- [`7.1-nts`, (*7.1/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.1/Dockerfile)
- [`7.2-nts`, (*7.1/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.2/Dockerfile)
- [`7.3-nts`, (*7.1/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.3/Dockerfile)

Images do not have `VOLUME` directories since fresh version of sources is supposed to be downloaded into image each time before running tests
- [`7.2-nts`, (*7.2/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.2/Dockerfile)
- [`7.3-nts`, (*7.3/Dockerfile*)](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/php/7.3/Dockerfile)

These images are built from [Linux for PHP official Docker images](https://hub.docker.com/r/asclinux/linuxforphp-8.1-ultimate), and additionally include:

- All extensions are compiled and ready and loaded
- PECL extensions: memcached, redis, mongodb, xdebug
- sendmail command via msmtp, configured as relay to localhost. Check `/etc/msmtprc` to setup relay server
- Git client
- Composer
- PHPUnit - latest stable version for php >= 5.6 and PHPUnit 4.8 for php < 5.6
- PHP Code Sniffer - latest stable version of `phpcs` and `phpcbf` commands
- Node.js v10 from official Node.js repositories

See below for details
- All extensions are compiled and ready and loaded,
- PECL extensions: memcached, redis, mongodb, xdebug,
- sendmail command via msmtp, configured as relay to localhost. Check `/etc/msmtprc` to setup relay server,
- Git client,
- Composer,
- PHPUnit - latest stable version for php >= 5.6 and PHPUnit 4.8 for php < 5.6,
- PHP Code Sniffer - latest stable version of `phpcs` and `phpcbf` commands,
- Node.js v10 from official Node.js repositories.

## Advantages of these images

- Builds are based on the official Linux for PHP images (standard C toolchain)
- Automatically rebuilt when official images are updated, so this repository always contains the latest versions
- Builds are based on the official Linux for PHP images (standard C toolchain).
- Automatically rebuilt when official images are updated, so this repository always contains the latest versions.

# Quick start guide

Expand All @@ -46,7 +42,7 @@ Check the [Quick start guide](https://github.com/linuxforphp/docker-gitlab-ci/bl
Check the [Example projects](https://github.com/linuxforphp/docker-gitlab-ci/tree/master/examples)

## PHP modules
All major modules are enabled by default (compiled-in) and some are installed using PECL
All major modules are enabled by default (compiled-in) and some are installed using PECL.

### Compiled-in modules
```
Expand All @@ -62,20 +58,20 @@ bcmath bz2 calendar ctype curl date dba dom ereg enchant exif fileinfo filter ft
memcached mongodb redis xdebug
```

For more information check the [Github repository](https://github.com/linuxforphp/docker-gitlab-ci/)
For more information check the [GitHub repository](https://github.com/linuxforphp/docker-gitlab-ci/).

## Environment variables

There are environment variables which can be passed to images on docker run
There are environment variables which can be passed to images on `docker run`.

- `WITHOUT_XDEBUG=1` - disables xdebug extension
- `TIMEZONE=America/New_York` - set system and `php.ini` timezone. You can also set timezone in .gitlab-ci.yml - check [Example](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/examples/purephp/.gitlab-ci.yml)
- `COMPOSER_GITHUB=<YOUR_GITHUB_TOKEN>` - Adds Github oauth token for Composer, which allows Composer to get unlimited repositories from Github without blocking non-interactive mode with request for authorization. You can obtain your token at [https://github.com/settings/tokens](https://github.com/settings/tokens)
- `WITHOUT_XDEBUG=1` - disables xdebug extension,
- `TIMEZONE=America/New_York` - set system and `php.ini` timezone. You can also set timezone in .gitlab-ci.yml - check [Example](https://github.com/linuxforphp/docker-gitlab-ci/blob/master/examples/purephp/.gitlab-ci.yml),
- `COMPOSER_GITHUB=<YOUR_GITHUB_TOKEN>` - Adds GitHub oauth token for Composer, which allows Composer to get unlimited repositories from Github without blocking non-interactive mode with request for authorization. You can obtain your token at [https://github.com/settings/tokens](https://github.com/settings/tokens).

[Composer documentation about Github API rate limit](https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens)

# FAQ

1. **How to set custom php.ini values**

Easiest way is to mount your local php.ini on container start like `docker run ... -v /home/user/php.ini:/etc/php.ini ...`
Easiest way is to mount your local `php.ini` on container start like `docker run ... -v /home/user/php.ini:/etc/php.ini ...`

0 comments on commit 1baa7ae

Please sign in to comment.