class Shiplane::ConvertDockerfile

Attributes

artifact_context[RW]
compose_context[RW]
project_folder[RW]

Public Class Methods

convert_output!(project_folder, artifact_context, compose_context) click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 56
def self.convert_output!(project_folder, artifact_context, compose_context)
  new(project_folder, artifact_context, compose_context).convert_output!
end
new(project_folder, artifact_context, compose_context) click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 10
def initialize(project_folder, artifact_context, compose_context)
  @project_folder = project_folder
  @artifact_context = artifact_context
  @compose_context = compose_context
end

Public Instance Methods

appname() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 16
def appname
  @appname ||= project_config['appname']
end
convert_output!() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 50
def convert_output!
  puts "Converting Dockerfile..."
  File.write(dockerfile_filepath, converted_output)
  puts "Dockerfile Converted..."
end
converted_output() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 42
def converted_output
  @converted_output ||= [
    File.read(dockerfile_filepath),
    File.read(dockerfile_production_stages_filepath),
    # "ENTRYPOINT #{entrypoint}",
  ].join("\n\n")
end
dockerfile_filepath() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 30
def dockerfile_filepath
  @dockerfile_filepath ||= File.join(project_folder, dockerfile_name)
end
dockerfile_name() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 24
def dockerfile_name
  @dockerfile_name ||= compose_context.fetch('build', {}).fetch('context', '.').tap do |filename|
    filename.gsub!(/^\.$/, 'Dockerfile')
  end
end
dockerfile_production_stages_filepath() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 34
def dockerfile_production_stages_filepath
  @dockerfile_production_stages_filepath ||= File.join(Dir.pwd, build_config.fetch('settings_folder', '.shiplane'), Shiplane::DEFAULT_PRODUCTION_DOCKERFILE_STAGES_FILEPATH)
end
entrypoint() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 38
def entrypoint
  @entrypoint ||= artifact_context.fetch('command', compose_context.fetch('command', "bin/rails s"))
end
shiplane_config() click to toggle source
# File lib/shiplane/convert_dockerfile.rb, line 20
def shiplane_config
  @shiplane_config ||= Shiplane::Configuration.new
end