diff --git a/composer/README-short.txt b/composer/README-short.txt new file mode 100644 index 000000000..171e2ab6f --- /dev/null +++ b/composer/README-short.txt @@ -0,0 +1 @@ +Composer is a dependency manager written in and for PHP. diff --git a/composer/content.md b/composer/content.md new file mode 100644 index 000000000..0fbde0c35 --- /dev/null +++ b/composer/content.md @@ -0,0 +1,81 @@ +# What is Composer? + +Composer is a tool for dependency management in PHP, written in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. + +You can read more about Composer in our [official documentation](https://getcomposer.org/doc/). + +%%LOGO%% + +# Using + +Run the `composer` image: + +```sh +docker run --rm --interactive --tty \ + --volume $PWD:/app \ + composer install +``` + +You can mount the Composer home directory from your host inside the Container to share caching and configuration files: + +```sh +docker run --rm --interactive --tty \ + --volume $PWD:/app \ + --volume $COMPOSER_HOME:/composer \ + composer install +``` + +By default, Composer runs as root inside the container. This can lead to permission issues on your host filesystem. You can run Composer as your local user: + +```sh +docker run --rm --interactive --tty \ + --volume $PWD:/app \ + --user $(id -u):$(id -g) \ + composer install +``` + +When you need to access private repositories, you will either need to share your configured credentials, or mount your `ssh-agent` socket inside the running container: + +```sh +docker run --rm --interactive --tty \ + --volume $PWD:/app \ + --volume $SSH_AUTH_SOCK:/ssh-auth.sock \ + --env SSH_AUTH_SOCK=/ssh-auth.sock \ + composer install +``` + +## Suggestions + +### PHP Extensions + +We strive to deliver an image that is as lean as possible, aimed at running Composer only. + +Sometimes dependencies or Composer [scripts](https://getcomposer.org/doc/articles/scripts.md) require the availability of certain PHP extensions. In this scenario, you have two options: + +- Pass the `--ignore-platform-reqs` and `--no-scripts` flags to `install` or `update`: + + ```sh + docker run --rm --interactive --tty \ + --volume $PWD:/app \ + composer install --ignore-platform-reqs --no-scripts + ``` + +- Create your own image (possibly by extending `FROM composer`). + +### Local runtime/binary + +If you want to be able to run `composer` as if it was installed on your host locally, you can define the following function in your `~/.bashrc`, `~/.zshrc` or similar: + +```sh +composer () { + tty= + tty -s && tty=--tty + docker run \ + $tty \ + --interactive \ + --rm \ + --user $(id -u):$(id -g) \ + --volume $(pwd):/app \ + composer "$@" +} +``` diff --git a/composer/github-repo b/composer/github-repo new file mode 100644 index 000000000..9ddd5c3e6 --- /dev/null +++ b/composer/github-repo @@ -0,0 +1 @@ +https://github.com/composer/docker diff --git a/composer/license.md b/composer/license.md new file mode 100644 index 000000000..c437f5c58 --- /dev/null +++ b/composer/license.md @@ -0,0 +1 @@ +View [license information](https://github.com/composer/composer/blob/master/LICENSE) for the software contained in this image. diff --git a/composer/logo.png b/composer/logo.png new file mode 100644 index 000000000..bb95a4928 Binary files /dev/null and b/composer/logo.png differ diff --git a/composer/user-feedback.md b/composer/user-feedback.md new file mode 100644 index 000000000..b2465edce --- /dev/null +++ b/composer/user-feedback.md @@ -0,0 +1,15 @@ +## Issues + +If you have any problems with or questions about this image, please contact us through a [GitHub issue](%%GITHUB-REPO%%/issues). If the issue is related to a CVE, please check for [a `cve-tracker` issue on the `official-images` repository first](https://github.com/docker-library/official-images/issues?q=label%3Acve-tracker). + +You can also reach us through the `#composer` or `#docker-library` IRC channels on [Freenode](https://freenode.net). + +## Contributing + +You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can. + +Before you start to code, we recommend discussing your plans through a [GitHub issue](%%GITHUB-REPO%%/issues), especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing. + +## Documentation + +Documentation for this image is stored in the [`%%REPO%%/` directory](https://github.com/docker-library/docs/tree/master/%%REPO%%) of the [`docker-library/docs` GitHub repo](https://github.com/docker-library/docs). Be sure to familiarize yourself with the [repository's `README.md` file](https://github.com/docker-library/docs/blob/master/README.md) before attempting a pull request.