Custom docker composer image

PHP Packages: Composer Custom docker composer image

Install custom php library from the officlal composer docker image

1. Setup the custom docker file

FROM composer:1.9.3

# Install required packages
RUN apk --no-cache add php7-gd freetype-dev libjpeg-turbo-dev libpng-dev


RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
  && docker-php-ext-install -j "$(nproc)" gd

2. Build custom composer docker image

docker build --no-cache -f="custom-composer.Dockerfile" -t="my-company/php-composer:0.1" .

3. Using the custom composer docker image

Install Packages

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  my-company/php-composer:0.1 require psr/log "^1.0"

Dump autoload

docker run --rm --interactive --tty \
  --volume $PWD:/app \
  my-company/php-composer:0.1 dump-autoload

Reference