Sign inSign up

ridibooks/platform-php-ci

By ridibooks

Updated about 6 years ago

Base Docker image for CI

Image
0

10K+

ridibooks/platform-php-ci repository overview

Base Docker Image for CI

Build Status

Using on Local Machine with GitLab Runner

  1. Build the image:
PHP_VERSION=[php_version] ./bin/build.sh
  1. Write .gitlab-ci.yml using ridibooks/platform-php-ci:[php_version] as a base image in your project.
  2. To run CI task on local machine, install GitLab Runner.
  3. Run gitlab-runner in the project dir. e.g.:
gitlab-runner exec docker [task_name] \
  --docker-pull-policy=never \
  --docker-volumes=/var/run/docker.sock:/var/run/docker.sock \
  --env AWS_ACCESS_KEY_ID=aws_access_key_id \
  --env AWS_SECRET_ACCESS_KEY=aws_secret_access_key \
  --env SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" \
  --env DOCKER_IMAGE=docker_image

Options for gitlab-runner exec docker:

  • --docker-pull-policy=never: Use local image instead of pulling from remote.
  • --docker-volumes=/var/run/docker.sock:/var/run/docker.sock: Bind socket to build Docker images within CI container. For more options, see GitLab Documentation.
  • --env [value] ...: Pass env variables to CI container.

Note: If a variable in .gitlab-ci.yml has the same name as env variable like below,

# .gitlab-ci.yml
variables:
  SSH_PRIVATE_KEY: ${SSH_PRIVATE_KEY}
# bash
gitlab-runner exec docker ... --env SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)"

GitLab Runner can not pass the value of env variable appropriately. So, you may need to do one of followings:

  • Temporarily remove the variable from .gitlab-ci.yml.
  • Use the different variable name.

This will occur only when using GitLab Runner (not GitLab CI).

Tag summary

Content type

Image

Digest

Size

351.9 MB

Last updated

about 6 years ago

docker pull ridibooks/platform-php-ci