https://github.com/flownative/docker-composer
Image providing PHP and composer for build purposes (used by the Beach builder.)
https://github.com/flownative/docker-composer
composer docker-image php release-automation
Last synced: 2 months ago
JSON representation
Image providing PHP and composer for build purposes (used by the Beach builder.)
- Host: GitHub
- URL: https://github.com/flownative/docker-composer
- Owner: flownative
- License: mit
- Created: 2020-01-13T17:36:07.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-02-20T08:56:43.000Z (over 1 year ago)
- Last Synced: 2025-02-20T09:38:07.865Z (over 1 year ago)
- Topics: composer, docker-image, php, release-automation
- Language: Shell
- Homepage:
- Size: 104 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](http://opensource.org/licenses/MIT)
[](https://www.flownative.com/en/products/open-source.html)
# Composer Docker Image
This Docker image provides [Composer](https://getcomposer.org/) based on
the Flownative Beach PHP images. By configuring your shell you can use
this image as a replacement for a regular locally installed Composer.
You may want to use this solution if you need to maintain projects using
Composer and Local Beach or Flownative Beach, because the PHP images
used for the development and hosting environment will be exactly the
same like the one used as a base for this image.
## Shell Configuration
To simplify the `docker run` calls, you may want to configure your shell
to do the heavy lifting for you. The easiest way is to declare functions
in your `.bashrc`, `.zshrc` or other shell profile.
For example, in order to use Composer based on PHP 7.4 with ZSH, add the
following to your `.zshrc` or the like:
```
composer74 () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/application:delegated \
--volume $HOME/.composer/cache:/home/composer/cache:delegated \
--volume $HOME/.composer/auth.json:/home/composer/auth.json \
flownative/composer:7.4 "$@"
}
```
Now you can run Composer simply by running something like the following:
```
composer74 -v update
```
## Private Packagist
If dependencies are located in Private Packagist, you need to provide
the HTTP Basic Auth credentials to the Composer container via the
`COMPOSER_AUTH` environment variable. Credentials are provided as a JSON
string ( [see Composer documentation](https://getcomposer.org/doc/articles/http-basic-authentication.md)).
```
composer74 () {
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
-e COMPOSER_AUTH="{"http-basic":{"repo.packagist.com":{"username":"token","password":"a524b…8ace"}}" \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/application:delegated \
--volume $HOME/.composer/cache:/home/composer/cache:delegated \
--volume $HOME/.composer/auth.json:/home/composer/auth.json \
flownative/composer:7.4 "$@"
}
```