Skip to content

Instantly share code, notes, and snippets.

@dflima
Created June 24, 2019 18:31
Show Gist options
  • Save dflima/d78cf11a4234d04a0d0dae457f39b4d4 to your computer and use it in GitHub Desktop.
Save dflima/d78cf11a4234d04a0d0dae457f39b4d4 to your computer and use it in GitHub Desktop.
Dockerfile for Memcached
# Memcached Dockerfile
#
# VERSION 0.0.1
FROM debian:jessie
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r memcache && useradd -r -g memcache memcache
RUN apt-get update && apt-get install -y libevent-2.0-5 && rm -rf /var/lib/apt/lists/*
ENV MEMCACHED_VERSION 1.5.7
ENV MEMCACHED_SHA1 31d6f6b80668025e4616aa2ad5c7a45f24ed9665
RUN buildDeps='curl gcc libc6-dev libevent-dev make perl'; \
set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -SL "http://memcached.org/files/memcached-$MEMCACHED_VERSION.tar.gz" -o memcached.tar.gz \
&& echo "$MEMCACHED_SHA1 memcached.tar.gz" | sha1sum -c - \
&& mkdir -p /usr/src/memcached \
&& tar -xzf memcached.tar.gz -C /usr/src/memcached --strip-components=1 \
&& rm memcached.tar.gz \
&& cd /usr/src/memcached \
&& ./configure \
&& make \
&& make install \
&& cd / && rm -rf /usr/src/memcached \
&& apt-get purge -y --auto-remove $buildDeps
EXPOSE 11211
USER memcache
CMD ["memcached", "-m", "320"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment