Skip to content

Instantly share code, notes, and snippets.

@danilin-em
Created November 27, 2019 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilin-em/340ffaea1234322888a41f12767da06f to your computer and use it in GitHub Desktop.
Save danilin-em/340ffaea1234322888a41f12767da06f to your computer and use it in GitHub Desktop.
Docker Entrypoint for PHP Alpine
#!/bin/sh
set -e
COMPOSER_BIN=/usr/local/bin/composer
if [ "$SKIP_COMPOSER" == "false" ]; then
if [ ! -f $COMPOSER_BIN ]; then
curl -sS https://getcomposer.org/installer | php
mv composer.phar $COMPOSER_BIN
fi
if [ -f /var/www/composer.json ]; then
$COMPOSER_BIN --working-dir=/var/www install
fi
fi
if [ ! -z "$XDEBUG_CONFIG" ]; then
apk add --no-cache $PHPIZE_DEPS
pecl install xdebug-2.8.0
docker-php-ext-enable xdebug
fi
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- php-fpm "$@"
fi
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment