Sha256: c8459317c32bdf90a21af6961f24491893ef759699e9e82ba32834d9f8ba861c
Contents?: true
Size: 1.09 KB
Versions: 9
Compression:
Stored size: 1.09 KB
Contents
require_relative 'base' require 'pathname' module LintTrap module Container # Acts like a container, without actually requiring a container. class Docker < Base CONFIG_PATH = Pathname.new('/opt/lint_trap/config') CODE_PATH = Pathname.new('/home/spin_cycle') def wrap(command) "docker run #{flags} #{image} #{command}" end def config_path(path) CONFIG_PATH.join(path).to_s end def local_path(path) relative_path = Pathname.new(path).relative_path_from(CODE_PATH) repo_path.join(relative_path).to_s end def container_path(path) relative_path = Pathname.new(path).relative_path_from(repo_path) CODE_PATH.join(relative_path).to_s end private def flags [ # '-m', '50m', # memory # '-c', '1', # number of cpus '--privileged=false', '-v', "#{LOCAL_CONFIG_PATH}:#{CONFIG_PATH}", '-v', "#{repo_path}:#{CODE_PATH}", "--workdir=#{CODE_PATH}", '--user=spin_cycle' ].join(' ') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems