Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # python 3.6.2
- import docker
- import os
- client = docker.from_env()
- client.images.build(path=".", tag="api_orders")
- try:
- kont = client.containers.get("api_orders")
- kont.remove(force=True)
- except:
- pass
- #templates_path = "/C/X/templates"
- #static_path = "/C/X/static"
- templates_path = (os.path.abspath(".") + r"\templates").replace('C:', "\c")
- static_path = (os.path.abspath(".") + r"\static").replace('C:', "\c")
- volumes = {templates_path: {'bind': '/app/templates', 'mode': ''}, static_path: {'bind': '/app/static', 'mode': ''}}
- client.containers.run(name="api_orders",
- image="api_orders",
- ports={80:35000},
- detach=True,
- restart_policy={"Name": "always"},
- volumes=volumes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement