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

Composer service in docker-compose.yml causing problems. #335

Closed
barat opened this issue Sep 17, 2018 · 2 comments
Closed

Composer service in docker-compose.yml causing problems. #335

barat opened this issue Sep 17, 2018 · 2 comments

Comments

@barat
Copy link

barat commented Sep 17, 2018

Hi,
I just want to inform, that placing composer service is not a good idea if you recommend to run the project via docker-compose up. It'll make both containers run, and files in vendor will be duplicated and we'll have warnings like this:
Warning: Ambiguous class resolution, "PharIo\Manifest\BundlesElement" was found in both "/opt/php/vendor/phar-io/manifest/src/xml/BundlesElement.php" and "/opt/php/vendor/phar-io/manifest/src/src/xml/BundlesElement.php", the first will be used.
It'll only happen when running it 1st time.

I'm not making a PR, because I'm not sure what the solution should be.

Easiest approaches:

  • In documentation just recommend to run project via docker-compose up php
  • Just remove composer service, and recommend to run it via docker run --rm. This might be good idea, since sometimes tty/interactive might be needed. Also current composer implementation in docker-compose.yml is not passing ssh-agent into container (https://hub.docker.com/_/composer/)

There is a hack also:

IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- docker-compose.yml	(revision e68d7b213ee1b88ffbca05420cd52eaf6df9b8b9)
+++ docker-compose.yml	(date 1537220686000)
@@ -12,5 +12,4 @@
     working_dir: /app
     volumes:
        - .:/app
-    command:
-      - install
+    command: 'true'

This will make composer service to return 0 immediately, so it'll not make duplicates in vendor.
But still - I'm not sure, if docker-compose should contain services which does nothing on docker-compose up

Other way is to have separate docker-compose.yml files for those services, but then it will be harder to execute them eg: docker-compose -f docker-compose.composer.yml run composer install

Unfortunately docker-compose doesn't provide a way to wait until other container finish. There is potential hack - remove composer part from test_runner.sh and then add composer service in depends_on, and in test_runner.sh ping composer service until it's down and then proceed.

@AchoArnold
Copy link

I can confirm that I ran into this same issue when I tried running docker-compose up

@domnikl
Copy link
Contributor

domnikl commented Oct 22, 2018

9910fdf should solve this issue. There is only one service in docker-compose.yml that runs Composer, cs and test via make now, so everything can be run using make (Sphinx build for readthedocs documentation is build using make, too).

@domnikl domnikl closed this as completed Oct 22, 2018
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

3 participants