Skip to content

Instantly share code, notes, and snippets.

@Moeser
Created September 15, 2016 23:53
Show Gist options
  • Save Moeser/e2dcd64b0e07076b36f8337530d731f3 to your computer and use it in GitHub Desktop.
Save Moeser/e2dcd64b0e07076b36f8337530d731f3 to your computer and use it in GitHub Desktop.
Dockerfile example of replacing alpine's php7-memcached package with one compiled from source
FROM alpine:edge
# Using this RUN line in place of where I normally would apk add php7-memcached
RUN echo '@community http://nl.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories && \
apk update && \
# Add packages and build dependencies
apk add --no-cache tar sed grep curl wget gzip pcre ca-certificates \
build-base zlib-dev autoconf libmemcached-dev \
php7@community php7-dev@community php7-session@community && \
# Fetch the php7-memcached source and build/install/cleanup
curl -o php7-memcached.tar.gz -SL https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz && \
tar -xzf php7-memcached.tar.gz && \
cd php-memcached-php7 && \
phpize7 && \
./configure --prefix=/usr --disable-memcached-sasl --with-php-config=php-config7 && \
make && \
make install && \
install -d /etc/php7/conf.d && \
echo "extension=memcached.so" > /etc/php7/conf.d/20_memcached.ini && \
cd .. && \
rm -rf php7-memcached.tar.gz && \
rm -rf php-memcached-php7 && \
# prune the build deps for php7-memcached.
apk del build-base zlib-dev autoconf libmemcached-dev php7-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment