Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
275 changes: 0 additions & 275 deletions compose/bundle.py

This file was deleted.

49 changes: 7 additions & 42 deletions compose/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
from inspect import getdoc
from operator import attrgetter

import docker
import docker.errors
import docker.utils

from . import errors
from . import signals
from .. import __version__
from ..bundle import get_image_digests
from ..bundle import MissingDigests
from ..bundle import serialize_bundle
from ..config import ConfigurationError
from ..config import parse_environment
from ..config import parse_labels
Expand All @@ -34,6 +32,8 @@
from ..const import IS_WINDOWS_PLATFORM
from ..errors import StreamParseError
from ..progress_stream import StreamOutputError
from ..project import get_image_digests
from ..project import MissingDigests
from ..project import NoSuchService
from ..project import OneOffFilter
from ..project import ProjectError
Expand Down Expand Up @@ -213,7 +213,6 @@ class TopLevelCommand(object):

Commands:
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
Expand Down Expand Up @@ -304,38 +303,6 @@ def build(self, options):
progress=options.get('--progress'),
)

def bundle(self, options):
"""
Generate a Distributed Application Bundle (DAB) from the Compose file.

Images must have digests stored, which requires interaction with a
Docker registry. If digests aren't stored for all images, you can fetch
them with `docker-compose pull` or `docker-compose push`. To push images
automatically when bundling, pass `--push-images`. Only services with
a `build` option specified will have their images pushed.

Usage: bundle [options]

Options:
--push-images Automatically push images for any services
which have a `build` option specified.

-o, --output PATH Path to write the bundle file to.
Defaults to "<project name>.dab".
"""
compose_config = get_config_from_options('.', self.toplevel_options)

output = options["--output"]
if not output:
output = "{}.dab".format(self.project.name)

image_digests = image_digests_for_project(self.project, options['--push-images'])

with open(output, 'w') as f:
f.write(serialize_bundle(compose_config, image_digests))

log.info("Wrote bundle to {}".format(output))

def config(self, options):
"""
Validate and view the Compose file.
Expand Down Expand Up @@ -1216,12 +1183,10 @@ def timeout_from_opts(options):
return None if timeout is None else int(timeout)


def image_digests_for_project(project, allow_push=False):
def image_digests_for_project(project):
try:
return get_image_digests(
project,
allow_push=allow_push
)
return get_image_digests(project)

except MissingDigests as e:
def list_images(images):
return "\n".join(" {}".format(name) for name in sorted(images))
Expand Down
Loading