class Lux::DockerImageTask

Public Class Methods

new(task_name, app) click to toggle source

This task checks to see if the image is present in the local Docker Server If present it returns the creation date as the timestamp, if not then it returns Rake::Early. This allows dependencies to execute correctly The action block should build the container.

Calls superclass method
# File lib/lux/docker_tasks.rb, line 46
def initialize(task_name, app)
  super(task_name, app)
  @imagename = @name
  @imagename += ':latest' unless @imagename.index(':')
  @image = DISABLED ? nil :
      Docker::Image.all.select{|i| i.info['RepoTags']&.include? @imagename}.first
end

Public Instance Methods

needed?() click to toggle source
# File lib/lux/docker_tasks.rb, line 54
def needed?
  return false if DISABLED
  ! @image || out_of_date?(timestamp) || @application.options.build_all
end
timestamp() click to toggle source
# File lib/lux/docker_tasks.rb, line 59
def timestamp
  return Time.now if DISABLED
  if @image = Docker::Image.all.select{|i| i.info['RepoTags']&.include? @imagename}.first
    Time.at(@image.info['Created'])
  else
    Rake::EARLY
  end
end