Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve installation script #10

Open
nicolashuber opened this issue Oct 3, 2020 · 0 comments
Open

Improve installation script #10

nicolashuber opened this issue Oct 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@nicolashuber
Copy link
Contributor

Today the installation process is written on bash script. It's difficult to maintain a complex script, it would be interesting to find a way to use a more modern programming language to run the installation.

I suggest use the The Console Component from Symfony. With a PHP we can create a more robust script. But on the one hand, PHP becomes a prerequisite together with Docker.

The great challenge is that the script should orchestrate all related containers. With this in mind, I thing the script must call the exec PHP function and call docke-compose.

To abstract we could have the following classes:

Docker.php:

<?php
namespace App\Docker;
class Docker {
    public function up($service, $args = null) {
        return exec('docker-compose -d up ' . $service . ' ' . $args . ' 2>&1');
    }
    public function run($service, $args = null) {
        return exec('docker-compose run --rm ' . $service . ' ' . $args . ' 2>&1');
    }
    public function pull() {
        return exec('docker-compose pull 2>&1');
    }
    public function build() {
        return exec('docker-compose build 2>&1');
    }
}

Yarn.php:

<?php
namespace App\Docker;
class Yarn extends Docker {
    public function install() {
        return $this->run('node', 'yarn');
    }
}

Another approach would be to use access the Docker Engine API, like the reactphp-docker library.

@nicolashuber nicolashuber added the enhancement New feature or request label Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant