Skip to content

PHP Composer - deploying packages #2

Description

@dan-burt

Hi.

I enjoyed the recipe 05 article about using composer within a container.

I am struggling getting 2 packages installed within my PHP container:

  • mongodb/mongodb
  • vlucas/phpdotenv

I started building this INSIDE the container (as you mention in Stage 1 - bad idea...) and I have the mongodb client / SDK working, though I had to hardcode some references to the usr/bin directory, rather than in the webserver's "root" directory (/var/www/html) - this was following some other guide which did the same. I actually keep this currently in a sub-folder and use docker-compose up -d to bring up the container. The mapping is:

    volumes:
      - ./html:/var/www/html

This however breaks now I want to use the 2nd package.

If I map an existing folder, with all my PHP pages & scripts, it doesn't work. If I omit this mapping, I can see that the packages seem to be installed, however my files are no longer there.

Searching around, I found your article and I am stuck at how to deploy the packages AND allow me to map my existing folder. What order does your setup execute? I am guessing the composer container completes the installs to it's /app local directory. This same directory is mapped to the php container, but how does it handle overwrites or which 1 is executed first?

Can I ask how you overcome this, as your mapped root folder only contains the composer.json file?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions