Skip to content

Commit cdbc854

Browse files
att
1 parent 368c065 commit cdbc854

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Creates a new container machine instance based on the specified distribution.
6666

6767
### LuaShipMachine
6868
#### Properties
69-
69+
##### `cache folder`
70+
specifies where to cache temporary DockerFiles(defaults to tmp/)
7071
##### `provider: "podman" | "docker"`
7172
Specifies the container runtime to use. Must be either "podman" or "docker".
7273

src/private_lua_ship.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
private_lua_ship.create_machine = function(start_image)
22
local self_obj = {}
3-
self_obj.provider = "docker"
3+
self_obj.provider = "docker"
44
self_obj.docker_file = "FROM " .. start_image .. "\n"
5+
self_obj.cache_folder = "/tmp"
56
self_obj.add_comptime_command = function(command)
67
private_lua_ship_machine_methods.add_comptime_command(self_obj, command)
78
end
@@ -19,7 +20,7 @@ private_lua_ship.create_machine = function(start_image)
1920
end
2021

2122
self_obj.build = function(name)
22-
return private_lua_ship_machine_methods.build(self_obj, name)
23+
return private_lua_ship_machine_methods.build(self_obj, name)
2324
end
2425
self_obj.start = function(props)
2526
private_lua_ship_machine_methods.start(self_obj, props)

src/private_machine_methods/cli_iteraction.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ private_lua_ship_machine_methods.build = function(self_obj, name)
66
if not name then
77
name = "sha" .. private_lua_ship.sha256(self_obj.docker_file)
88
end
9-
local filename = name .. ".Dockerfile"
9+
local filename = self_obj.cache_folder .. "/" .. name .. ".Dockerfile"
1010
private_lua_ship_machine_methods.save_to_file(self_obj, filename)
1111
local command = self_obj.provider .. " build -t " .. name .. " -f " .. filename .. " . --quiet "
1212
local ok = private_lua_ship.os_execute(command)
@@ -42,8 +42,8 @@ private_lua_ship_machine_methods.start = function(self_obj, props)
4242
end
4343
command = command .. name
4444
if props.command then
45-
local formmated = private_lua_ship.string.gsub(props.command, "'", "'\\''")
46-
command = command .. " sh -c '" .. formmated.."'"
45+
local formmated = private_lua_ship.string.gsub(props.command, "'", "'\\''")
46+
command = command .. " sh -c '" .. formmated .. "'"
4747
end
4848
local ok = private_lua_ship.os_execute(command)
4949
if not ok then

0 commit comments

Comments
 (0)