protected function generateDockerCompose($dev = false)
    {
        $docker_compose = new DockerComposeConfig();
        $docker_compose->setVersion(static::DOCKER_VERSION);

        $has_proxy = $this->hasTraefik() ? true : false;

        foreach ($this->getServices() as $name => $info) {
            if (!isset($info['type'])) {
                continue;
            }
            $type = $info['type'];
            $instance = self::loadService($this, $type, $name);

            if (!$dev && $has_proxy) {
                $instance->setInternal();
                if (isset($info['bind_ports']) && $info['bind_ports']) {
                    $instance->bindPorts();
                }
            }

            if (isset($info['version'])) {
                $instance->setVersion($info['version']);
            }
            $volumes = $dev ? $instance->devVolumes() : $instance->volumes();
            $service = $dev ? $instance->devService() : $instance->getService();

            if (!empty($volumes)) {
                $docker_compose->setVolumes($volumes);
            }

            if (!$service->isEmpty()) {
                $docker_compose->setService($name, $service);
            }
        }

        if (!$dev && $has_proxy) {
            $docker_compose->setNetworks([
                'internal' => [
                    'external' => 'false',
                ],
                static::TRAEFIK_NETWORK => [
                    'external' => [
                        'name' => static::TRAEFIK_NETWORK
                    ]
                ]
            ]);
        }

        return $docker_compose;
    }
protected function generateDockerCompose($dev = false)
    {
        $docker_compose = new DockerComposeConfig();
        $docker_compose->setVersion(static::DOCKER_VERSION);

        $has_proxy = $this->hasTraefik() ? true : false;

        foreach ($this->getServices() as $name => $info) {
            if (!isset($info['type'])) {
                continue;
            }
            $type = $info['type'];
            $instance = self::loadService($this, $type, $name);

            if (!$dev && $has_proxy) {
                $instance->setInternal();
                if (isset($info['bind_ports']) && $info['bind_ports']) {
                    $instance->bindPorts();
                }
            }

            if (isset($info['version'])) {
                $instance->setVersion($info['version']);
            }
            $volumes = $dev ? $instance->devVolumes() : $instance->volumes();
            $service = $dev ? $instance->devService() : $instance->getService();

            if (!empty($volumes)) {
                $docker_compose->setVolumes($volumes);
            }

            if (!$service->isEmpty()) {
                $docker_compose->setService($name, $service);
            }
        }

        if (!$dev && $has_proxy) {
            $docker_compose->setNetworks([
                'internal' => [
                    'external' => 'false',
                ],
                static::TRAEFIK_NETWORK => [
                    'external' => [
                        'name' => static::TRAEFIK_NETWORK
                    ]
                ]
            ]);
        }

        return $docker_compose;
    }
protected function generateDockerCompose ( $ dev = false ) { $ docker_compose = new DockerComposeConfig ( ) ; $ docker_compose -> setVersion ( static :: DOCKER_VERSION ) ; $ has_proxy = $ this -> hasTraefik ( ) ? true : false ; foreach ( $ this -> getServices ( ) as $ name => $ info ) { if ( ! isset ( $ info [ 'type' ] ) ) { continue ; } $ type = $ info [ 'type' ] ; $ instance = self :: loadService ( $ this , $ type , $ name ) ; if ( ! $ dev && $ has_proxy ) { $ instance -> setInternal ( ) ; if ( isset ( $ info [ 'bind_ports' ] ) && $ info [ 'bind_ports' ] ) { $ instance -> bindPorts ( ) ; } } if ( isset ( $ info [ 'version' ] ) ) { $ instance -> setVersion ( $ info [ 'version' ] ) ; } $ volumes = $ dev ? $ instance -> devVolumes ( ) : $ instance -> volumes ( ) ; $ service = $ dev ? $ instance -> devService ( ) : $ instance -> getService ( ) ; if ( ! empty ( $ volumes ) ) { $ docker_compose -> setVolumes ( $ volumes ) ; } if ( ! $ service -> isEmpty ( ) ) { $ docker_compose -> setService ( $ name , $ service ) ; } } if ( ! $ dev && $ has_proxy ) { $ docker_compose -> setNetworks ( [ 'internal' => [ 'external' => 'false' , ] , static :: TRAEFIK_NETWORK => [ 'external' => [ 'name' => static :: TRAEFIK_NETWORK ] ] ] ) ; } return $ docker_compose ; }
Generate docker-compose object.

@param bool $dev
Determine if a dev version should be generated.
@return \Droath\ProjectX\Config\DockerComposeConfig
The docker compose configuration.
Generate docker - compose object .