Skip to content

Instantly share code, notes, and snippets.

@Tymek
Last active December 15, 2018 14:31
Show Gist options
  • Save Tymek/8c4128f2edd365b1297da8c12ba7b3aa to your computer and use it in GitHub Desktop.
Save Tymek/8c4128f2edd365b1297da8c12ba7b3aa to your computer and use it in GitHub Desktop.
Composer in Docker with signature verification
FROM php
RUN apt-get update
# Install Composer
# @see https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
ARG COMPOSER_URL="https://raw.githubusercontent.com/composer/getcomposer.org/d3e09029468023aa4e9dcd165e9b6f43df0a9999/web/installer"
ARG COMPOSER_SIGNATURE="93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8"
RUN php -r "copy(getenv('COMPOSER_URL'), 'composer-setup.php'); \
if (hash_file('sha384', 'composer-setup.php') === getenv('COMPOSER_SIGNATURE')) { \
include('composer-setup.php'); } else { throw new Exception('Composer corrupted'); }" \
&& php -r "unlink('composer-setup.php'); rename('composer.phar', '/usr/local/bin/composer');"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment