Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

ridibooks-docker/platform-php-ci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Base Docker image for CI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •