class Docker::Build

Public Class Methods

bin_dependencies() click to toggle source
# File lib/scripts/docker/build.rb, line 10
def bin_dependencies
  ["docker"]
end
description() click to toggle source
# File lib/scripts/docker/build.rb, line 4
      def description
        <<-MARKDOWN
          Uses docker to build the docker image for the current project.
        MARKDOWN
      end

Public Instance Methods

run() click to toggle source
# 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