Skip to content

Instantly share code, notes, and snippets.

@SamSaffron
Created December 11, 2015 06:38
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 SamSaffron/b424b59e77ccdb1eb909 to your computer and use it in GitHub Desktop.
Save SamSaffron/b424b59e77ccdb1eb909 to your computer and use it in GitHub Desktop.
# use 15.10 to get 1.0.2 openssl
FROM ubuntu:15.10
ENV HAPROXY_MAJOR 1.6
ENV HAPROXY_VERSION 1.6.2
ENV HAPROXY_MD5 d0ebd3d123191a8136e2e5eb8aaff039
ENV LUA_VERSION 5.3.2
ENV LUA_MD5 33278c2ab5ee3c1a875be8d55c1ca2a1
ENV TINI_VERSION v0.8.4
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/local/bin/tini
RUN chmod +x /usr/local/bin/tini
ADD disabled-is-not-shutdown-dammit.patch tmp
# see http://sources.debian.net/src/haproxy/1.5.8-1/debian/rules/ for some
# helpful navigation of the possible "make" arguments
RUN set -x \
&& apt-get update \
&& apt-get install -y libssl1.0.0 libpcre3 libreadline6 --no-install-recommends
# Split this RUN into two parts so that the system packages we install can be
# in a separate image, and I don't have to keep pushing an image with
# mostly-the-same-stuff-in-it.
RUN buildDeps='build-essential curl libssl-dev libpcre3-dev libreadline-dev' \
&& set -x \
&& apt-get install -y $buildDeps --no-install-recommends \
&& curl -SL "http://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz" -o lua.tar.gz \
&& echo "${LUA_MD5} lua.tar.gz" | md5sum -c \
&& mkdir -p /usr/src/lua \
&& tar -xzf lua.tar.gz -C /usr/src/lua --strip-components=1 \
&& rm lua.tar.gz \
&& cd /usr/src/lua && make linux && make INSTALL_TOP=/opt/lua53 install \
&& rm -fr /usr/srv/lua \
&& curl -SL "http://www.haproxy.org/download/${HAPROXY_MAJOR}/src/haproxy-${HAPROXY_VERSION}.tar.gz" -o haproxy.tar.gz \
&& echo "${HAPROXY_MD5} haproxy.tar.gz" | md5sum -c \
&& mkdir -p /usr/src/haproxy \
&& tar -xzf haproxy.tar.gz -C /usr/src/haproxy --strip-components=1 \
&& rm haproxy.tar.gz \
&& cd /usr/src/haproxy \
&& patch -p1 < /tmp/disabled-is-not-shutdown-dammit.patch \
&& rm /tmp/*.patch \
&& make -j -C /usr/src/haproxy \
TARGET=linux2628 \
USE_PCRE=1 PCREDIR= \
USE_OPENSSL=1 \
USE_ZLIB=1 \
USE_LUA=yes \
LUA_LIB=/opt/lua53/lib/ \
LUA_INC=/opt/lua53/include/ \
all \
install-bin \
&& rm -rf /usr/src/haproxy \
&& apt-get purge -y --auto-remove $buildDeps \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ADD haproxy-init sbin/init
ENTRYPOINT ["/usr/local/bin/tini", "--", "/sbin/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment