Exemplo n.º 1
0
    def run(self):

        # Get the docker client.
        docker_client = docker.from_env()

        # Determine the app.
        app = self.options["<app>"]
        clean = self.options["--clean"]

        # Ensure it's a built app
        if app is not None and App.get_build_dir(app):

            # Check if we should clean it.
            if clean:
                App.clean_images(docker_client, app)

            App.build(app)

        else:

            # Iterate through built apps
            for app in App.get_built_apps():

                # Check if we should clean it.
                if clean:
                    App.clean_images(docker_client, app)

                App.build(app)
Exemplo n.º 2
0
    def run(self):

        # Determine the app.
        app = self.options["<app>"]

        # Ensure it's a built app
        logger.debug("({}) Check for need to initialize".format(app))
        if app is not None and App.get_repo_url(app) and App.get_repo_branch(
                app):

            # Initializer.
            logger.debug("({}) Preparing to initialize with branch: {}".format(
                app, App.get_repo_branch(app)))
            App.init(app)

        else:

            # Iterate through built apps
            for app in App.get_built_apps():

                # Ensure it's a built app
                if App.get_repo_url(app) and App.get_repo_branch(app):

                    # Initializer.
                    logger.debug("({}) Preparing to initialize".format(app))
                    App.init(app)
Exemplo n.º 3
0
    def run(self):

        # Get the docker client.
        docker_client = docker.from_env()

        # Check it.
        if not App.check(docker_client):
            logger.critical(
                "Stack is invalid! Ensure all paths and images are correct"
                " and try again")
            return

        # Check for clean.
        if self.options["--clean"]:

            App.clean_images(docker_client)

        # Iterate through built apps
        for app in App.get_built_apps():
            App.build(app)

        # Build the command.
        command = ["docker-compose", "up"]

        # Check for the daemon flag.
        if self.options["-d"]:
            command.append("-d")

        # Check for flags
        if self.options.get("<flags>"):

            # Split them, append the '--' and add them to the command
            for flag in self.options.get("<flags>").split(","):
                command.append("-{}".format(flag) if len(flag) ==
                               1 else "--{}".format(flag))

        # Run the pre-build hook, if any
        Stack.hook("pre-up")

        # Capture and redirect output.
        logger.debug("Running docker-compose up...")

        Stack.run(command)

        # Run the pre-build hook, if any
        Stack.hook("post-up")