Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compile memcache on alpine container for PHP 5.5 and 5.6
# php-5.5
FROM daccbr/php:5.5-fpm-alpine
RUN addgroup -g 1000 sumup && adduser -u 1000 -h /home/sumup -H -G sumup -s /bin/false -D sumup
RUN apk --update add openssh-client libtool make grep autoconf gcc libc-dev zlib-dev
RUN cd /tmp \
&& apk --update add cyrus-sasl-dev libmemcached-dev \
&& curl -L --progress-bar -o "php-memcached-2.2.0.tar.gz" "https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz" \
&& tar -xzvf php-memcached-2.2.0.tar.gz \
&& cd php-memcached-2.2.0 \
&& phpize \
&& ./configure --disable-memcached-sasl \
&& make \
&& make install \
&& docker-php-ext-enable memcached \
&& cd .. \
&& rm -rf php-memcached-2.2.0 \
&& rm php-memcached-2.2.0.tar.gz
# php-5.6
FROM php:php5-alpine
RUN apk --update add openssh-client make grep autoconf gcc libc-dev zlib-dev
RUN cd /tmp \
&& curl -o php-memcache.tgz http://pecl.php.net/get/memcache-3.0.8.tgz \
&& tar -xzvf php-memcache.tgz \
&& cd memcache-3.0.8 \
&& curl -o memcache-faulty-inline.patch http://git.alpinelinux.org/cgit/aports/plain/main/php5-memcache/memcache-faulty-inline.patch?h=3.4-stable \
&& patch -p1 -i memcache-faulty-inline.patch \
&& phpize \
&& ./configure --prefix=/usr \
&& make INSTALL_ROOT=/ install \
&& install -d ./etc/php/conf.d \
&& echo "extension=memcache.so" > /usr/local/etc/php/conf.d/memcache.ini
@inl-pd-autotest
Copy link

inl-pd-autotest commented Mar 12, 2018

I needed php5-memcached for php5.6, the upper script failed (changed FROM to just alpine:3.4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment