Usage:
sync {
docker,
source = ".",
target="container:/path/in/container/",
host=os.getenv("DOCKER_HOST"),
excludes = {
'.git'
},
}| docker = { | |
| checkgauge = { | |
| host = true, | |
| excludes = true | |
| }, | |
| delay = 0, | |
| maxProcesses = 1, | |
| action = function(inlet) | |
| local config = inlet.getConfig() | |
| local event = inlet.getEvent() | |
| local p = event.pathname | |
| local target = event.targetPathname | |
| if config.host == nil then | |
| log("Normal", "No DOCKER_HOST set, defaulting to 'unix://'") | |
| config.host = 'unix://' | |
| end | |
| log("Normal", "Event "..event.etype..", Pathname is ."..p) | |
| for key,exclude in ipairs(config.excludes) do | |
| if string.match(p, exclude) then | |
| log("Normal", "Path is excluded '"..p.."' by '"..exclude.."'") | |
| inlet.discardEvent(event); | |
| return; | |
| end | |
| end | |
| if event.etype == "Create" or event.etype == "Modify" then | |
| spawnShell(event, "docker -H "..config.host.." cp ."..p.." "..target) | |
| return | |
| end | |
| inlet.discardEvent(event) | |
| end, | |
| collect = function(agent, exitcode) | |
| return 'ok' | |
| end | |
| } |