Sign inSign up

hermsi/alpine-composer

By hermsi

Updated over 5 years ago

Dockerize your composer upon a lightweight alpine image with tons of extensions

Image
1

10K+

hermsi/alpine-composer repository overview

Make your composer fly on Alpine

Overview

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.

Features

Basic Usage

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:

  1. Create a file in /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 "$@"
    
  2. Create an alias in your .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.

Versions and Tags

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:latest
  • hermsi/alpine-composer:php7.1

Tag summary

Content type

Image

Digest

Size

74.3 MB

Last updated

over 5 years ago

docker pull hermsi/alpine-composer:2.0.14-php7.4