diff --git a/.travis.yml b/.travis.yml index b1126b7..772c416 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,8 @@ sudo: required services: - docker -before_install: - - make - script: - - make test + - make notifications: email: false diff --git a/1.0/Dockerfile b/1.0/Dockerfile deleted file mode 100644 index c730e1b..0000000 --- a/1.0/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.0.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.0/alpine/Dockerfile b/1.0/alpine/Dockerfile deleted file mode 100644 index 244c65b..0000000 --- a/1.0/alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.0.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.0/php5-alpine/Dockerfile b/1.0/php5-alpine/Dockerfile deleted file mode 100644 index 0fc2638..0000000 --- a/1.0/php5-alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.0.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.0/php5/Dockerfile b/1.0/php5/Dockerfile deleted file mode 100644 index bbdd6c1..0000000 --- a/1.0/php5/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5 -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.0.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.1/Dockerfile b/1.1/Dockerfile deleted file mode 100644 index 98dabf8..0000000 --- a/1.1/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.1.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.1/alpine/Dockerfile b/1.1/alpine/Dockerfile deleted file mode 100644 index 578af43..0000000 --- a/1.1/alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.1.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.1/php5-alpine/Dockerfile b/1.1/php5-alpine/Dockerfile deleted file mode 100644 index 3e48640..0000000 --- a/1.1/php5-alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.1.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.1/php5/Dockerfile b/1.1/php5/Dockerfile deleted file mode 100644 index 799c4d8..0000000 --- a/1.1/php5/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5 -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.1.3 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.2/Dockerfile b/1.2/Dockerfile index babf169..fdd50ce 100644 --- a/1.2/Dockerfile +++ b/1.2/Dockerfile @@ -1,11 +1,47 @@ -# Composer Docker Container -FROM composer/composer:base -MAINTAINER Rob Loach +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:7-cli -ENV COMPOSER_VERSION 1.2.0 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php +ENV TINI_VERSION v0.10.0 +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc -# Display version information. -RUN composer --version +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION 1.2.1 +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/1.2/alpine/Dockerfile b/1.2/alpine/Dockerfile index f5aa21d..dce9e71 100644 --- a/1.2/alpine/Dockerfile +++ b/1.2/alpine/Dockerfile @@ -1,11 +1,37 @@ -# Composer Docker Container -FROM composer/composer:base-alpine -MAINTAINER Rob Loach +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:7-alpine -ENV COMPOSER_VERSION 1.2.0 +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini -# Display version information. -RUN composer --version +ENV COMPOSER_VERSION 1.2.1 +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/1.2/php5-alpine/Dockerfile b/1.2/php5-alpine/Dockerfile deleted file mode 100644 index c953fb8..0000000 --- a/1.2/php5-alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 1.2.0 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/1.2/php5/Dockerfile b/1.2/php5/Dockerfile index ac5bc01..039903d 100644 --- a/1.2/php5/Dockerfile +++ b/1.2/php5/Dockerfile @@ -1,11 +1,47 @@ -# Composer Docker Container -FROM composer/composer:base-php5 -MAINTAINER Rob Loach +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:5-cli -ENV COMPOSER_VERSION 1.2.0 +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php +ENV TINI_VERSION v0.10.0 +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc -# Display version information. -RUN composer --version +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION 1.2.1 +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/1.2/php5/alpine/Dockerfile b/1.2/php5/alpine/Dockerfile new file mode 100644 index 0000000..bc1eedf --- /dev/null +++ b/1.2/php5/alpine/Dockerfile @@ -0,0 +1,37 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:5-alpine + +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION 1.2.1 +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template deleted file mode 100644 index fe01c65..0000000 --- a/Dockerfile-alpine.template +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 0.0.0 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/Dockerfile-php5-alpine.template b/Dockerfile-php5-alpine.template deleted file mode 100644 index 0cdc0ba..0000000 --- a/Dockerfile-php5-alpine.template +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 0.0.0 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/Dockerfile-php5.template b/Dockerfile-php5.template deleted file mode 100644 index e460d62..0000000 --- a/Dockerfile-php5.template +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5 -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 0.0.0 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/Dockerfile.template b/Dockerfile.template deleted file mode 100644 index 8528f20..0000000 --- a/Dockerfile.template +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION 0.0.0 - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php - -# Display version information. -RUN composer --version diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..933422a --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) Composer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 6f686d4..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,25 +0,0 @@ -LICENSE -======= - -This project is released under the MIT License: - -> Copyright (C) 2014+ [Rob Loach](http://robloach.net) -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> "Software"), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile index b657faf..7cee8c1 100644 --- a/Makefile +++ b/Makefile @@ -1,73 +1,23 @@ -build: build-1.0 build-1.1 build-1.2 build-master +.PHONY = all build test -test: build test-1.0 test-1.1 test-1.2 test-master +all: build test -build-base: - docker build -t composer/composer:base base - docker build -t composer/composer:base-alpine base/alpine - docker build -t composer/composer:base-php5 base/php5 - docker build -t composer/composer:base-php5-alpine base/php5-alpine +build: build/1.2 build/master -build-master: build-base - docker build -t composer/composer:master master - docker build -t composer/composer:master-alpine master/alpine - docker build -t composer/composer:master-php5 master/php5 - docker build -t composer/composer:master-php5-alpine master/php5-alpine +test: test/1.2 test/master -test-master: - @echo -n "master\t\t\t" - @docker run composer/composer:master --version --no-ansi - @echo -n "master-alpine\t\t" - @docker run composer/composer:master-alpine --version --no-ansi - @echo -n "master-php5\t\t" - @docker run composer/composer:master-php5 --version --no-ansi - @echo -n "master-php5-alpine\t" - @docker run composer/composer:master-php5-alpine --version --no-ansi +build/%: + docker build -t composer/composer:$* $* + docker build -t composer/composer:$*-alpine $*/alpine + docker build -t composer/composer:$*-php5 $*/php5 + docker build -t composer/composer:$*-php5-alpine $*/php5/alpine -build-1.0: build-base - docker build -t composer/composer:1.0 1.0 - docker build -t composer/composer:1.0-alpine 1.0/alpine - docker build -t composer/composer:1.0-php5 1.0/php5 - docker build -t composer/composer:1.0-php5-alpine 1.0/php5-alpine - -test-1.0: - @echo -n "1.0\t\t\t" - @docker run composer/composer:1.0 --version --no-ansi - @echo -n "1.0-alpine\t\t" - @docker run composer/composer:1.0-alpine --version --no-ansi - @echo -n "1.0-php5\t\t" - @docker run composer/composer:1.0-php5 --version --no-ansi - @echo -n "1.0-php5-alpine\t\t" - @docker run composer/composer:1.0-php5-alpine --version --no-ansi - -build-1.1: build-base - docker build -t composer/composer:1.1 1.1 - docker build -t composer/composer:1.1-alpine 1.1/alpine - docker build -t composer/composer:1.1-php5 1.1/php5 - docker build -t composer/composer:1.1-php5-alpine 1.1/php5-alpine - -test-1.1: - @echo -n "1.1\t\t\t" - @docker run composer/composer:1.1 --version --no-ansi - @echo -n "1.1-alpine\t\t" - @docker run composer/composer:1.1-alpine --version --no-ansi - @echo -n "1.1-php5\t\t" - @docker run composer/composer:1.1-php5 --version --no-ansi - @echo -n "1.1-php5-alpine\t\t" - @docker run composer/composer:1.1-php5-alpine --version --no-ansi - -build-1.2: build-base - docker build -t composer/composer:1.2 1.2 - docker build -t composer/composer:1.2-alpine 1.2/alpine - docker build -t composer/composer:1.2-php5 1.2/php5 - docker build -t composer/composer:1.2-php5-alpine 1.2/php5-alpine - -test-1.2: - @echo -n "1.2\t\t\t" - @docker run composer/composer:1.2 --version --no-ansi - @echo -n "1.2-alpine\t\t" - @docker run composer/composer:1.2-alpine --version --no-ansi - @echo -n "1.2-php5\t\t" - @docker run composer/composer:1.2-php5 --version --no-ansi - @echo -n "1.2-php5-alpine\t\t" - @docker run composer/composer:1.2-php5-alpine --version --no-ansi +test/%: + @echo composer/composer:$* + @docker run composer/composer:$* --version --no-ansi + @echo composer/composer:$*-alpine + @docker run composer/composer:$*-alpine --version --no-ansi + @echo composer/composer:$*-php5 + @docker run composer/composer:$*-php5 --version --no-ansi + @echo composer/composer:$*-php5-alpine + @docker run composer/composer:$*-php5-alpine --version --no-ansi diff --git a/README.md b/README.md index 49a5358..3ac8cfd 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,52 @@ -# Supported tags and respective `Dockerfile` links - -- `1.0` -- `1.0-alpine` -- `1.0-php5` -- `1.0-php5-alpine` -- `1.1`, `1`, `latest` -- `1.1-php5`, `1-php5`, `php5` -- `1.1-alpine`, `1-alpine`, `alpine` -- `1.1-php5-alpine`, `1-php5-alpine`, `php5-alpine` -- `master` -- `master-php5` -- `master-alpine` -- `master-php5-alpine` +# Supported tags and their respective `Dockerfile` links + +- `1.2`, `1`, `latest` ([1.2/Dockerfile][]) +- `1.2-alpine`, `1-alpine`, `alpine` ([1.2-alpine/Dockerfile][]) +- `1.2-php5`, `1-php5`, `php5` ([1.2-php5/Dockerfile][]) +- `1.2-php5-alpine`, `1-php5-alpine`, `php5-alpine` ([1.2-php5-alpine/Dockerfile][]) +- `master` ([master/Dockerfile][]) +- `master-alpine` ([master-alpine/Dockerfile][]) +- `master-php5` ([master-php5/Dockerfile][]) +- `master-php5-alpine` ([master-php5-alpine/Dockerfile][]) + # What is Composer? -Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. +[Composer][] is a tool for dependency management in PHP. It allows you to +declare the libraries your project depends on and it will manage (install / +update) them for you. -> [wikipedia.org/wiki/Composer (software)](https://en.wikipedia.org/wiki/Composer_(software)) -![Composer Logo](https://getcomposer.org/img/logo-composer-transparent.png "Composer") +## Installing -# How to use this image. +Pull the `composer/composer` image from the hub repository: -## Installation / Usage +``` sh +docker pull composer/composer +``` -1. Install the `composer/composer` container: +Alternatively, pull a specific variant of `composer/composer`: - ``` sh - $ docker pull composer/composer - ``` +``` sh +docker pull composer/composer:alpine +``` - Alternatively, pull a specific version of `composer/composer`: - ``` sh - $ docker pull composer/composer:1.1 - ``` +## Using -2. Create a composer.json defining your dependencies. Note that this example is -a short version for applications that are not meant to be published as packages -themselves. To create libraries/packages please read the -[documentation](http://getcomposer.org/doc/02-libraries.md). - - ``` json - { - "require": { - "monolog/monolog": ">=1.0.0" - } - } - ``` +Run the `composer/composer` image: -3. Run Composer through the Composer container: +``` sh +docker run --rm -v $(pwd):/app composer/composer install +``` - ``` sh - $ docker run --rm -v $(pwd):/app composer/composer install - ``` - Or run using a specific version of Composer: - ``` sh - $ docker run --rm -v $(pwd):/app composer/composer:1.1 install - ``` - If working with packages installed via git ssh the local .ssh directory shall be mapped into the container: - ```sh - $ docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh composer/composer install - ``` +Alternatively, run a specific variant of `composer/composer`: -4. Add optional `composer` command to the host (tested on OS X El Capitan with docker-machine) +``` sh +docker run --rm -v $(pwd):/app composer/composer:alpine install +``` - Create new composer file - ```sh - $ sudo vim /usr/local/bin/composer - ``` +You can mount the Composer home directory from your host inside the Container +to share caching and configuration files: The contents of the file will look like this: ```sh @@ -78,30 +56,62 @@ themselves. To create libraries/packages please read the docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh -v $HOME/.composer-docker:/composer composer/composer $@ ``` - Once the script has been made, it must be set as executable - ```sh - $ sudo chmod +x /usr/local/bin/composer - ``` +## Suggestions - Now the `composer` command is available native on host: - ```sh - $ composer --version +We strive to deliver an image that is as lean as possible, aimed at running +Composer only. + +Sometimes dependencies or [composer scripts] require the availability of certain +PHP extensions. In this scenario, you have two options: + +* create your own image (by extending from one of the variants we offer), +* pass the `--ignore-platform-reqs` and `--no-scripts` flags to `install` and + `update`. + + ``` sh + docker run --rm -v $(pwd):/app composer/composer install --no-scripts -ignore-platform-reqs ``` +If you want to be able to just run `composer`, you can define the following +function in your `~/.bashrc`, `~/.zshrc` or similar: + +``` sh +function composer () { + docker run --rm -v $(pwd):/app composer/composer "$@" +} +``` + # Image Variants -## `composer/composer:` +### `composer/composer:` + +This is the defacto image. If you are unsure about what your needs are, you +probably want to use this one. + +### `composer/composer:-alpine` -This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. +This image is based on the popular [Alpine Linux project][], available in [the +`alpine` official image][]. Alpine Linux is much smaller than most distribution +base images (~5MB), and thus leads to much slimmer images in general. -## `composer/composer:php5` +### `composer/composer:-php5` -This is made to run Composer through PHP 5, rather then the default of PHP 7. +This image runs the latest version of PHP 5 instead of PHP 7. -## `composer/composer:alpine` +### `composer/composer:-php5-alpine` -This image is based on the popular [Alpine Linux project](http://alpinelinux.org/), available in [the alpine official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. +This image runs the latest version of PHP 5 instead of PHP 7. -## `composer/composer:php5-alpine` -This is made to run Composer through PHP 5, rather then the default of PHP 7, through the Alpine container. +[Composer]: https://getcomposer.org +[Alpine Linux project]: http://alpinelinux.org +[the `alpine` official image]: https://hub.docker.com/_/alpine +[composer scripts]: https://getcomposer.org/doc/articles/scripts.md +[1.2/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/1.2/Dockerfile +[1.2-alpine/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/1.2/alpine/Dockerfile +[1.2-php5/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/1.2/php5/Dockerfile +[1.2-php5-alpine/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/1.2/php5/alpine/Dockerfile +[master/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/master/Dockerfile +[master-alpine/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/master/alpine/Dockerfile +[master-php5/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/master/php5/Dockerfile +[master-php5-alpine/Dockerfile]: https://github.com/RobLoach/docker-composer/blob/master/master/php5/alpine/Dockerfile diff --git a/base/Dockerfile b/base/Dockerfile deleted file mode 100644 index 1c318b0..0000000 --- a/base/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# Composer Docker Container -# Base Dockerfile: composer/base -FROM php:7-cli -MAINTAINER Rob Loach - -# Packages -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng12-dev \ - libbz2-dev \ - libxslt-dev \ - libldap2-dev \ - php-pear \ - curl \ - git \ - subversion \ - unzip \ - wget \ - && rm -r /var/lib/apt/lists/* - -# PHP Extensions -RUN docker-php-ext-install bcmath mcrypt zip bz2 mbstring pcntl xsl \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install gd \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-install ldap - -# Memory Limit -RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini - -# Time Zone -RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini - -# Disable Populating Raw POST Data -# Not needed when moving to PHP 7. -# http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data -RUN echo "always_populate_raw_post_data=-1" > $PHP_INI_DIR/conf.d/always_populate_raw_post_data.ini - -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer - -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /composer/vendor/bin:$PATH - -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 - -# Setup the Composer installer -RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \ - && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ - && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" - -# Set up the volumes and working directory -VOLUME ["/app"] -WORKDIR /app - -# Set up the command arguments -CMD ["-"] -ENTRYPOINT ["composer", "--ansi"] diff --git a/base/alpine/Dockerfile b/base/alpine/Dockerfile deleted file mode 100644 index edb4de0..0000000 --- a/base/alpine/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -# Composer Docker Container -# Base Dockerfile: composer/base-alpine -FROM php:7.0-alpine -MAINTAINER Rob Loach - -# Packages -RUN apk --update add \ - autoconf \ - build-base \ - curl \ - git \ - subversion \ - freetype-dev \ - libjpeg-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libbz2 \ - libstdc++ \ - libxslt-dev \ - openldap-dev \ - make \ - unzip \ - wget && \ - docker-php-ext-install bcmath mcrypt zip bz2 mbstring pcntl xsl && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ - docker-php-ext-install gd && \ - docker-php-ext-configure ldap --with-libdir=lib/ && \ - docker-php-ext-install ldap && \ - apk del build-base && \ - rm -rf /var/cache/apk/* - -# PEAR tmp fix -RUN echo "@testing http://dl-4.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \ - apk add --update php7-pear@testing && \ - rm -rf /var/cache/apk/* - -# Memory Limit -RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini - -# Time Zone -RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini - -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer - -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /composer/vendor/bin:$PATH - -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 - -# Setup the Composer installer -RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \ - && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ - && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" - -# Set up the volumes and working directory -VOLUME ["/app"] -WORKDIR /app - -# Set up the command arguments -CMD ["-"] -ENTRYPOINT ["composer", "--ansi"] diff --git a/base/php5-alpine/Dockerfile b/base/php5-alpine/Dockerfile deleted file mode 100644 index 0b111f8..0000000 --- a/base/php5-alpine/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -# Composer Docker Container -# Base Dockerfile: composer/base-php5-alpine -FROM php:5-alpine -MAINTAINER Rob Loach - -# Packages -RUN apk --update add \ - autoconf \ - build-base \ - curl \ - git \ - subversion \ - freetype-dev \ - libjpeg-turbo-dev \ - libmcrypt-dev \ - libpng-dev \ - libbz2 \ - libstdc++ \ - libxslt-dev \ - openldap-dev \ - make \ - php5-pear \ - unzip \ - wget && \ - docker-php-ext-install bcmath mcrypt zip bz2 mbstring pcntl xsl && \ - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ - docker-php-ext-install gd && \ - docker-php-ext-configure ldap --with-libdir=lib/ && \ - docker-php-ext-install ldap && \ - apk del build-base && \ - rm -rf /var/cache/apk/* - -# Memory Limit -RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini - -# Time Zone -RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini - -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer - -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /composer/vendor/bin:$PATH - -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 - -# Setup the Composer installer -RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \ - && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ - && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" - -# Set up the volumes and working directory -VOLUME ["/app"] -WORKDIR /app - -# Set up the command arguments -CMD ["-"] -ENTRYPOINT ["composer", "--ansi"] diff --git a/base/php5/Dockerfile b/base/php5/Dockerfile deleted file mode 100644 index c1a0c33..0000000 --- a/base/php5/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -# Composer Docker Container -# Base Dockerfile: composer/base -FROM php:5-cli -MAINTAINER Rob Loach - -# Packages -RUN apt-get update && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libmcrypt-dev \ - libpng12-dev \ - libbz2-dev \ - libxslt-dev \ - libldap2-dev \ - php-pear \ - curl \ - git \ - subversion \ - unzip \ - wget \ - && rm -r /var/lib/apt/lists/* - -# PHP Extensions -RUN docker-php-ext-install bcmath mcrypt zip bz2 mbstring pcntl xsl \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install gd \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-install ldap - -# Memory Limit -RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini - -# Time Zone -RUN echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini - -# Disable Populating Raw POST Data -# Not needed when moving to PHP 7. -# http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data -RUN echo "always_populate_raw_post_data=-1" > $PHP_INI_DIR/conf.d/always_populate_raw_post_data.ini - -# Register the COMPOSER_HOME environment variable -ENV COMPOSER_HOME /composer - -# Add global binary directory to PATH and make sure to re-export it -ENV PATH /composer/vendor/bin:$PATH - -# Allow Composer to be run as root -ENV COMPOSER_ALLOW_SUPERUSER 1 - -# Setup the Composer installer -RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \ - && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \ - && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" - -# Set up the volumes and working directory -VOLUME ["/app"] -WORKDIR /app - -# Set up the command arguments -CMD ["-"] -ENTRYPOINT ["composer", "--ansi"] diff --git a/master/Dockerfile b/master/Dockerfile index a4dddae..460b666 100644 --- a/master/Dockerfile +++ b/master/Dockerfile @@ -1,11 +1,42 @@ -# Composer Docker Container -FROM composer/composer:base -MAINTAINER Rob Loach +FROM php:7-cli -ENV COMPOSER_VERSION master +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php +ENV TINI_VERSION v0.10.0 -# Display version information -RUN composer --version +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --snapshot \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/master/alpine/Dockerfile b/master/alpine/Dockerfile index 107b831..91d44ea 100644 --- a/master/alpine/Dockerfile +++ b/master/alpine/Dockerfile @@ -1,11 +1,31 @@ -# Composer Docker Container -FROM composer/composer:base-alpine -MAINTAINER Rob Loach +FROM php:7-alpine -ENV COMPOSER_VERSION master +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini -# Display version information -RUN composer --version +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --snapshot \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/master/php5-alpine/Dockerfile b/master/php5-alpine/Dockerfile deleted file mode 100644 index c03d121..0000000 --- a/master/php5-alpine/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# Composer Docker Container -FROM composer/composer:base-php5-alpine -MAINTAINER Rob Loach - -ENV COMPOSER_VERSION master - -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php - -# Display version information -RUN composer --version diff --git a/master/php5/Dockerfile b/master/php5/Dockerfile index 2526299..8672de5 100644 --- a/master/php5/Dockerfile +++ b/master/php5/Dockerfile @@ -1,11 +1,42 @@ -# Composer Docker Container -FROM composer/composer:base-php5 -MAINTAINER Rob Loach +FROM php:5-cli -ENV COMPOSER_VERSION master +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* -# Install Composer -RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php +ENV TINI_VERSION v0.10.0 -# Display version information -RUN composer --version +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --snapshot \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/master/php5/alpine/Dockerfile b/master/php5/alpine/Dockerfile new file mode 100644 index 0000000..daccf40 --- /dev/null +++ b/master/php5/alpine/Dockerfile @@ -0,0 +1,31 @@ +FROM php:5-alpine + +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --snapshot \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/templates/Dockerfile b/templates/Dockerfile new file mode 100644 index 0000000..15146f6 --- /dev/null +++ b/templates/Dockerfile @@ -0,0 +1,47 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:7-cli + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* + +ENV TINI_VERSION v0.10.0 +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION %%COMPOSER_VERSION%% +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/templates/alpine/Dockerfile b/templates/alpine/Dockerfile new file mode 100644 index 0000000..9e61488 --- /dev/null +++ b/templates/alpine/Dockerfile @@ -0,0 +1,37 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:7-alpine + +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION %%COMPOSER_VERSION%% +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/templates/php5/Dockerfile b/templates/php5/Dockerfile new file mode 100644 index 0000000..ddb9460 --- /dev/null +++ b/templates/php5/Dockerfile @@ -0,0 +1,47 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:5-cli + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git subversion openssh-client openssl mercurial \ + && rm -r /var/lib/apt/lists/* + +ENV TINI_VERSION v0.10.0 +RUN curl --silent --location --output /sbin/tini https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini \ + && curl --silent --location --output /sbin/tini.asc https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \ + && gpg --verify /sbin/tini.asc \ + && chmod +x /sbin/tini \ + && rm /sbin/tini.asc + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION %%COMPOSER_VERSION%% +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/templates/php5/alpine/Dockerfile b/templates/php5/alpine/Dockerfile new file mode 100644 index 0000000..16a711b --- /dev/null +++ b/templates/php5/alpine/Dockerfile @@ -0,0 +1,37 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# +FROM php:5-alpine + +RUN apk --no-cache add curl git subversion openssh openssl mercurial tini + +RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini \ + && echo "date.timezone=${PHP_TIMEZONE:-UTC}" > $PHP_INI_DIR/conf.d/date_timezone.ini + +ENV COMPOSER_VERSION %%COMPOSER_VERSION%% +ENV COMPOSER_HOME /composer +ENV PATH /composer/vendor/bin:$PATH +ENV COMPOSER_ALLOW_SUPERUSER 1 +RUN curl --silent --location --output /tmp/composer-setup.php https://getcomposer.org/installer \ + && curl --silent --location --output /tmp/composer-setup.sig https://composer.github.io/installer.sig \ + && php -r " \ + \$hash = hash('SHA384', file_get_contents('/tmp/composer-setup.php')); \ + \$signature = trim(file_get_contents('/tmp/composer-setup.sig')); \ + if (!hash_equals(\$signature, \$hash)) { \ + unlink('/tmp/composer-setup.php'); \ + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ + exit(1); \ + }" \ + && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \ + && rm /tmp/composer-setup.php \ + && composer --ansi --version --no-interaction + +WORKDIR /app + +VOLUME /composer + +CMD ["--ansi", "--version"] + +ENTRYPOINT ["/sbin/tini", "--", "/usr/bin/composer"] diff --git a/update.sh b/update.sh index 83f6c68..dcb4acd 100755 --- a/update.sh +++ b/update.sh @@ -1,9 +1,5 @@ #!/bin/bash -# -# Usage: ./update.sh x.y.z -# -# This script runs to create a Dockerfile for a new Composer version. -# If you specify a partial version, like '1' or '1.0', it will determine the most recent sub version like 1.0.1. + set -eo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" @@ -15,47 +11,48 @@ if [ ${#versions[@]} -eq 0 ]; then fi versions=( "${versions[@]%/}" ) -function writeFiles { - local fullVersion=$1 +function copyTemplates { + local tag=$1 + local shortTag=$(echo $tag | sed -r -e 's/^([0-9]+.[0-9]+).*/\1/') local variant=$2 - shortVersion=$(echo $fullVersion | sed -r -e 's/^([0-9]+.[0-9]+).*/\1/') if [[ -z $variant ]]; then - targetDir="$shortVersion" - template=Dockerfile.template + targetDir="$shortTag" + template=templates/Dockerfile else - targetDir="$shortVersion/$variant" - template=Dockerfile-$variant.template + targetDir="$shortTag/$variant" + template=templates/$variant/Dockerfile fi + targetFile="$targetDir/Dockerfile" + mkdir -p "$targetDir" - cp $template "$targetDir/Dockerfile" - if [[ -f docker-entrypoint.sh ]]; then - cp -r docker-entrypoint.sh "$targetDir" - fi - sed -r -i -e 's/^(ENV COMPOSER_VERSION) .*/\1 '"$fullVersion"'/' "$targetDir/Dockerfile" + cp "$template" "$targetFile" + + sed -ri 's/%%COMPOSER_VERSION%%/'"$tag"'/' "$targetFile" } -tags="$(git ls-remote --tags https://github.com/composer/composer.git | cut -d/ -f3 | cut -d^ -f1 | cut -dv -f2 | sort -rV)" +tags="$(git ls-remote --tags --refs https://github.com/composer/composer | cut -d/ -f3 | sort -rV)" for version in "${versions[@]}"; do - possibleVersions="$(echo "$tags" | grep "^$version" )" - if releaseVersions="$(echo "$possibleVersions" | grep -ivEm1 'milestone|-alpha|-beta|-rc')"; then - fullVersion="$releaseVersions" + matches="$(echo "$tags" | grep "^$version" )" + + if releases="$(echo "$matches" | grep -ivEm1 'milestone|-alpha|-beta|-rc')"; then + tag="$releases" else - fullVersion="$(echo "$possibleVersions" | head -n1)" + tag="$(echo "$matches" | head -n1)" fi - if [[ -z $fullVersion ]]; then - echo "Cannot find version: $version" + if [[ -z $tag ]]; then + echo "Cannot find tag matching version: $version" exit 1 fi - ( - set -x - writeFiles $fullVersion - writeFiles $fullVersion 'alpine' - writeFiles $fullVersion 'php5' - writeFiles $fullVersion 'php5-alpine' - ) + # base for given tag + copyTemplates "$tag" + + # variants for given tag + for target in alpine php5 php5/alpine; do + copyTemplates "$tag" "$target" + done done