Exemplo n.º 1
0
def build_web_app_image():
  context = { "parent_image_id": Image.image_id_of("web-basement")[0], "port_maps": [{container: 80}, {container: 443}] }
  source_file = './templates/Dockerfile-web-app'
  destination_file = './tmp/Dockerfile'

  run("mkdir -p ./tmp")
  files.upload_template(source_file, destination_file, context=context, mode=0777)

  image = Image("web-app", destination_file)
  image.build()
  run("rm -rf ./tmp")
  return image
Exemplo n.º 2
0
def build_mysql_image():
  context = { "parent_image_id": Image.image_id_of("basement")[0], "root_password": "" }
  source_file = './templates/Dockerfile-mysql'
  destination_file = './tmp/Dockerfile'

  run("mkdir -p ./tmp")
  files.upload_template(source_file, destination_file, mode=0777)

  image = Image("mysql", destination_file)
  image.build()
  run("rm -rf ./tmp")
  return image
Exemplo n.º 3
0
def build_web_basement_image():
  context = { "parent_image_id": Image.image_id_of("basement")[0] }
  source_file = './templates/Dockerfile-web-server'
  destination_file = './tmp/Dockerfile'

  run("mkdir -p ./tmp")
  files.upload_template(source_file, destination_file, context=context, mode=0777)
  files.upload_template("./templates/nginx/default", "./tmp/default", mode=0644)
  files.upload_template("./templates/nginx/default-ssl", "./tmp/default-ssl", mode=0644)

  image = Image("web-basement", destination_file)
  image.build()
  run("rm -rf ./tmp")
  return image
Exemplo n.º 4
0
def remove_images(repository_name, tag = None):
  for image_id in Image.image_id_of(repository_name, tag):
    remove_all_containers_of(repository_name, tag)
    sudo("docker rmi %s" % (image_id))
Exemplo n.º 5
0
def remove_images_without_latest_one(repository_name):
  for image_id in Image.image_id_of(repository_name)[1:]:
    sudo("docker rmi %s" % (image_id))