Module: BuildSpecRunner::DefaultImages

Defined in:
lib/build_spec_runner/default_images.rb

Overview

Module for building the default AWS CodeBuild images. See DefaultImages.build_image

Constant Summary collapse

REPO_PATH =

The default directory used to clone the AWS CodeBuild Images repo

'/tmp/build_spec_runner/'
DEFAULT_DOCKERFILE_PATH =

The default CodeBuild Dockerfile

'ubuntu/ruby/2.3.1/'

Class Method Summary collapse

Class Method Details

.build_image(opts = {}) ⇒ Docker::Image

Build an AWS CodeBuild Docker image.

Defaults to the AWS CodeBuild Ruby 2.3.1 image. Different AWS CodeBuild images can be specified by setting :aws_dockerfile_path to a different setting, the default is DEFAULT_DOCKERFILE_PATH. This method clones the AWS CodeBuild Images repo locally. The repo will be cloned to REPO_PATH, unless a different repo path is specified by setting :repo_path.

Parameters:

  • opts (Hash) (defaults to: {})

    A hash containing optional values

    • :dockerfile_path (String) — override chosen AWS CodeBuild dockerfile.

    • :repo_path (String) — override path to clone AWS CodeBuild repo.

Returns:

  • (Docker::Image)

    A docker image with the specified AWS CodeBuild image.

See Also:



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/build_spec_runner/default_images.rb', line 32

def self.build_image opts={}

  dockerfile_path = opts[:aws_dockerfile_path]
  dockerfile_path ||= DEFAULT_DOCKERFILE_PATH
  repo_path = opts[:repo_path]
  repo_path ||= REPO_PATH

  repo = self.load_image_repo repo_path
  docker_dir = File.join(repo.dir.path, dockerfile_path)
  Docker::Image.build_from_dir(docker_dir)
end