Class: Docker::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/scripts/docker/build.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.bin_dependenciesObject



10
11
12
# File 'lib/scripts/docker/build.rb', line 10

def bin_dependencies
  ["docker"]
end

.descriptionObject



4
5
6
7
8
# File 'lib/scripts/docker/build.rb', line 4

def description
  "    Uses docker to build the docker image for the current project.\n  MARKDOWN\nend\n"

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/scripts/docker/build.rb', line 15

def run
  env_require("DOCKER_IMAGE")

  # set image tag if it hasnt been set
  # Default: git tag
  # Description: My favoruite thing
  env_check("IMAGE_TAG", `git rev-parse HEAD`.strip)

  dockerfile = env_fetch("BUILD_DOCKERFILE", "Dockerfile")
  # project_folder = env_fetch("DOCKER_FOLDER", ".")

  # build docker image
  command("docker build --pull -t \"$DOCKER_IMAGE:$IMAGE_TAG\" -f #{dockerfile} .")

  # push docker image
  command('docker push "$DOCKER_IMAGE:$IMAGE_TAG"')
end