Skip to content

Instantly share code, notes, and snippets.

@tommy-muehle
Created August 14, 2018 07:50
Show Gist options
  • Save tommy-muehle/7878aa389a7bdc32317a8998341c1da1 to your computer and use it in GitHub Desktop.
Save tommy-muehle/7878aa389a7bdc32317a8998341c1da1 to your computer and use it in GitHub Desktop.
PHP alpine example
FROM alpine:3.7
MAINTAINER Tommy Muehle <[email protected]>
ENV COMPOSER_HOME /composer
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV PATH /composer/vendor/bin:$PATH
RUN apk --update --progress --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/community add \
curl \
php7 \
# Install further extensions, for example php7-xdebug
php7-ctype \
php7-curl \
php7-dom \
php7-fileinfo \
php7-ftp \
php7-iconv \
php7-json \
php7-mbstring \
php7-mysqlnd \
php7-openssl \
php7-pdo \
php7-pdo_sqlite \
php7-phar \
php7-posix \
php7-session \
php7-simplexml \
php7-sqlite3 \
php7-tokenizer \
php7-xml \
php7-xmlreader \
php7-xmlwriter \
php7-zlib \
# Add Composer
&& 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');" \
# Make some .ini modifications
&& echo "date.timezon=Europe/Berlin" > /etc/php7/conf.d/99_customize.ini \
# Cleanup
&& rm -rf /var/cache/apk/* /var/tmp/* /tmp/*
VOLUME ["/app"]
WORKDIR /app
ENTRYPOINT ["php"]
CMD ["-m"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment