Skip to content

Instantly share code, notes, and snippets.

@madflow
Last active October 2, 2017 07:27
Show Gist options
  • Save madflow/123d44f0977e1cf2b9e20bab31c2b2b6 to your computer and use it in GitHub Desktop.
Save madflow/123d44f0977e1cf2b9e20bab31c2b2b6 to your computer and use it in GitHub Desktop.
Quick and dirty php-cs-fixer
FROM php:5.6-alpine
RUN apk update --no-cache \
&& apk add --no-cache tini \
&& rm -rf /var/cache/apk/* /var/tmp/* /tmp/*
ENV COMPOSER_HOME /composer
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini
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'))) { echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer \
&& php -r "unlink('/tmp/composer-setup.php');" \
&& php -r "unlink('/tmp/composer-setup.sig');"
ENV PATH /composer/vendor/bin:$PATH
RUN composer global require friendsofphp/php-cs-fixer \
&& composer global show | grep php-cs-fixer
VOLUME ["/app"]
WORKDIR /app
ENTRYPOINT ["/sbin/tini", "--", "php-cs-fixer"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment