Advertisement
Guest User

Untitled

a guest
Aug 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. # python 3.6.2
  2. import docker
  3. import os
  4.  
  5. client = docker.from_env()
  6. client.images.build(path=".", tag="api_orders")
  7.  
  8. try:
  9. kont = client.containers.get("api_orders")
  10. kont.remove(force=True)
  11. except:
  12. pass
  13.  
  14. #templates_path = "/C/X/templates"
  15. #static_path = "/C/X/static"
  16.  
  17. templates_path = (os.path.abspath(".") + r"\templates").replace('C:', "\c")
  18. static_path = (os.path.abspath(".") + r"\static").replace('C:', "\c")
  19.  
  20. volumes = {templates_path: {'bind': '/app/templates', 'mode': ''}, static_path: {'bind': '/app/static', 'mode': ''}}
  21.  
  22. client.containers.run(name="api_orders",
  23. image="api_orders",
  24. ports={80:35000},
  25. detach=True,
  26. restart_policy={"Name": "always"},
  27. volumes=volumes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement