mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
New Dockerfile operation: 'add'
This commit is contained in:
parent
09b1cd58c0
commit
71199f595d
1 changed files with 8 additions and 4 deletions
|
@ -69,11 +69,14 @@ def insert(base, src, dst, author=None):
|
||||||
stdin.seek(0)
|
stdin.seek(0)
|
||||||
return run_and_commit(base, "cat > {0}; chmod +x {0}".format(dst), stdin=stdin, author=author)
|
return run_and_commit(base, "cat > {0}; chmod +x {0}".format(dst), stdin=stdin, author=author)
|
||||||
|
|
||||||
def push(base, dst, author=None):
|
def add(base, src, dst, author=None):
|
||||||
print "PUSH to {} in {}".format(dst, base)
|
print "PUSH to {} in {}".format(dst, base)
|
||||||
|
if src == ".":
|
||||||
|
tar = subprocess.Popen(["tar", "-c", "."], stdout=subprocess.PIPE).stdout
|
||||||
|
else:
|
||||||
|
tar = subprocess.Popen(["curl", src], stdout=subprocess.PIPE).stdout
|
||||||
if dst == "":
|
if dst == "":
|
||||||
raise Exception("Missing argument to push")
|
raise Exception("Missing argument to push")
|
||||||
tar = subprocess.Popen(["tar", "-c", "."], stdout=subprocess.PIPE).stdout
|
|
||||||
return run_and_commit(base, "mkdir -p '{0}' && tar -C '{0}' -x".format(dst), stdin=tar, author=author)
|
return run_and_commit(base, "mkdir -p '{0}' && tar -C '{0}' -x".format(dst), stdin=tar, author=author)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -104,8 +107,9 @@ def main():
|
||||||
steps.append(result)
|
steps.append(result)
|
||||||
base = result
|
base = result
|
||||||
print "===> " + base
|
print "===> " + base
|
||||||
elif op == "push":
|
elif op == "add":
|
||||||
result = push(base, param.strip(), author=maintainer)
|
src, dst = param.split(" ", 1)
|
||||||
|
result = add(base, src, dst, author=maintainer)
|
||||||
steps.append(result)
|
steps.append(result)
|
||||||
base=result
|
base=result
|
||||||
print "===> " + base
|
print "===> " + base
|
||||||
|
|
Loading…
Add table
Reference in a new issue