class LambdaLayerCake::RakeHelper
Attributes
root[R]
Public Class Methods
new(root)
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 7 def initialize(root) @root = root end
Public Instance Methods
build_version()
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 50 def build_version @build_version ||= begin t = Time.now "build-#{t.strftime("%Y-%m-%d-%H-%M-%S")}" end end
config()
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 42 def config Rails.configuration.moonbase_alpha end
docker_build_definitions!()
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 11 def docker_build_definitions! desc "Build Docker Image" task :build do dockerfile_path = File.expand_path(__dir__ + "/../../templates/Dockerfile") raise "Must specify a repository in moonbase_alpha.yml" if repository.blank? tag = "#{repository}:#{build_version}" cmd = %W{docker build -f #{dockerfile_path} --build-arg RUNTIME_VERSION=#{RUBY_VERSION} --build-arg BLDTIME_PKGS=#{config.build_packages.join(" ")} --build-arg RUNTIME_PKGS=#{config.run_packages.join(" ")} --build-arg COMPILE_ASSETS=#{config.compile_assets.to_s} -t #{tag} #{root}} system(*cmd) or raise end desc "Output the last version built" task :latest_tag do puts latest_tag end desc "Output the image name for the latest build" task :latest_image do puts "#{repository}:#{latest_tag}" end end
latest_tag()
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 57 def latest_tag @latest_tag ||= begin cmd = %W{ docker image list --format {{.Tag}} #{repository} } IO.popen(cmd) do |versions| versions.readlines.select {|v| v =~ /\Abuild-/ }.sort.last end end end
repository()
click to toggle source
# File lib/moonbase_alpha/rake_helper.rb, line 46 def repository config.repository end