Dockerize your composer upon a lightweight alpine image with tons of extensions
10K+
This is a Dockerfile/image to build a container for composer based on PHP 7.1 or 7.2.
Most of the regular needed modules (apcu, opcache, php-redis, etc.) are built in and configured like suggested on php.net.
This Image is intended to be used as an replacement for composer.
I recommend to create a file named composer-docker somwhere in your $PATH.
If you want to do it like me, do it like that:
/usr/local/bin which provides the composer-command with the following content:
$ vim /usr/local/bin/composer-docker
#!/bin/bash
composer () {
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)":/app \
hermsi/alpine-composer "$@"
}
composer "$@"
.bashrc or .zshrc:
$ alias "composer"="sudo bash /usr/local/bin/composer-docker"After that you should be able to use composer-command directly in your shell.
This image is currently available with PHP 7.1 and PHP 7.2.
Depending on your application you may want to change the image to use in your composer-function
hermsi/alpine-composer:php7.2, hermsi/alpine-composer:latesthermsi/alpine-composer:php7.1Content type
Image
Digest
Size
74.3 MB
Last updated
over 5 years ago
docker pull hermsi/alpine-composer:2.0.14-php7.4