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

Install composer in php container? #5

Open
mr-feek opened this issue Jul 5, 2020 · 2 comments
Open

Install composer in php container? #5

mr-feek opened this issue Jul 5, 2020 · 2 comments

Comments

@mr-feek
Copy link
Contributor

mr-feek commented Jul 5, 2020

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
Copy link
Owner

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:

  • Keeps containers lighter
  • No build tool mixed with PHP
  • Use composer's official image

Cons:

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

@mr-feek
Copy link
Contributor Author

mr-feek commented Jul 6, 2020

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:

  • Install all of the same platform dependencies to the composer container as the php container
  • Don't use composer for checking/enforcing platform requirements <-- This seems to be the approach that you prefer
  • Install composer in the php container <-- This seems to be the approach that I prefer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants