AdrienPoupa / laradose

Customizable Docker-compose template made for Laravel
46 stars 10 forks source link

Install composer in php container? #5

Open mr-feek opened 4 years ago

mr-feek commented 4 years ago

Do we need an additional container just for composer? I have several extensions I am installing in my php container, which should also be installed in the composer container. I personally am going to remove the composer container. What is the main benefit of having a container just for composer?

AdrienPoupa commented 4 years ago

There are pros and cons of having them in different containers, it's more of a personal choice I guess.

Pros of having different containers:

Cons:

mr-feek commented 4 years ago

Composer container cannot check for installed PHP dependencies, so need to use ignore-platform-reqs

In my case, this was the (breaking) con. For example, my project requires the bcmath extension to be installed. I rely on composer to ensure that the current environment has that installed.

I was also getting this console output when using the composer container. Maybe it was using composer 2 or something that no longer has the flag? I'm not sure, I didn't dig into it.

The "--ignore-platform-reqs" option does not exist. ``` docker-compose up WARNING: Found orphan containers (85d461f6330b_web_artisan_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. Starting web_mysql_1 ... done Starting web_nginx_1 ... done Starting web_composer_1 ... done Recreating web_npm_1 ... done Starting web_php_1 ... done Attaching to web_composer_1, web_php_1, web_nginx_1, web_mysql_1, web_npm_1 mysql_1 | 2020-07-05 22:04:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started. mysql_1 | 2020-07-05 22:04:00+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' php_1 | [05-Jul-2020 22:04:00] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root php_1 | [05-Jul-2020 22:04:00] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root php_1 | [05-Jul-2020 22:04:00] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root php_1 | [05-Jul-2020 22:04:00] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root php_1 | [05-Jul-2020 22:04:00] NOTICE: fpm is running, pid 1 mysql_1 | 2020-07-05 22:04:00+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.20-1debian10 started. php_1 | [05-Jul-2020 22:04:00] NOTICE: ready to handle connections mysql_1 | 2020-07-05T22:04:00.816543Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release. mysql_1 | 2020-07-05T22:04:00.816720Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 1 mysql_1 | 2020-07-05T22:04:00.826619Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. mysql_1 | 2020-07-05T22:04:01.014879Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. mysql_1 | 2020-07-05T22:04:01.143725Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060 mysql_1 | 2020-07-05T22:04:01.228059Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. mysql_1 | 2020-07-05T22:04:01.231847Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory. mysql_1 | 2020-07-05T22:04:01.271788Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.20' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. composer_1 | composer_1 | composer_1 | [Symfony\Component\Console\Exception\RuntimeException] composer_1 | The "--ignore-platform-reqs" option does not exist. ```

The options (as I see them) are to: