add composer docs

This commit is contained in:
Rob Bast 2016-11-23 11:25:21 +01:00
parent 6df7cddc52
commit 58f7363e6c
No known key found for this signature in database
GPG Key ID: 73076E35E6165F39
6 changed files with 99 additions and 0 deletions

View File

@ -0,0 +1 @@
Composer is a dependency manager written in and for PHP.

81
composer/content.md Normal file
View File

@ -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 "$@"
}
```

1
composer/github-repo Normal file
View File

@ -0,0 +1 @@
https://github.com/composer/docker

1
composer/license.md Normal file
View File

@ -0,0 +1 @@
View [license information](https://github.com/composer/composer/blob/master/LICENSE) for the software contained in this image.

BIN
composer/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

15
composer/user-feedback.md Normal file
View File

@ -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.