diff options
| author | Christine Dodrill <me@christine.website> | 2018-10-04 19:44:06 -0700 |
|---|---|---|
| committer | Christine Dodrill <me@christine.website> | 2018-10-04 19:44:06 -0700 |
| commit | 1c1d089725dd9f98b7ac73276d07dbadb388b748 (patch) | |
| tree | b0e783f5e2d485050e0072faf3b303bdc66e3539 /tools/svc/methods/docker.lua | |
| parent | e36f755db2198a96e2b87781f5f5432fcee092dd (diff) | |
| download | x-1c1d089725dd9f98b7ac73276d07dbadb388b748.tar.xz x-1c1d089725dd9f98b7ac73276d07dbadb388b748.zip | |
add Dockerfile
Diffstat (limited to 'tools/svc/methods/docker.lua')
| -rw-r--r-- | tools/svc/methods/docker.lua | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/tools/svc/methods/docker.lua b/tools/svc/methods/docker.lua deleted file mode 100644 index 766718f..0000000 --- a/tools/svc/methods/docker.lua +++ /dev/null @@ -1,43 +0,0 @@ -local json = require "json" -local sh = require "sh" - -if os.getenv("DIE_ON_ERROR") == "yes" then - sh { abort = true } -end - --- given the name, docker image name and environment --- variables for this service, deploy it via Docker --- running locally. -function deploy(name, imagename, vars, settings) - args = { "run", "-d", "--name", name, "--label", "xe.svc.name="..name} - - for k,v in pairs(vars) do - table.insert(args, "--env") - table.insert(args, k .. "=" .. v) - end - - table.insert(args, imagename) - - local cmd = sh.docker(unpack(args)) - cmd:ok() - - local ctrid = cmd:lines()() - return ctrid -end - --- given a container name, return a table of information --- about it -function inspect(name) - local obj = sh.docker("inspect", ctrid):combinedOutput() - local tbl, err = json.decode(obj) - if err ~= nil then - error(err, obj) - end - - return tbl -end - --- kill a container by a given name -function kill(name) - sh.docker("rm", "-f", name):ok() -end |
