|
| 1 | +FROM golang:alpine AS dataplaneapi-builder |
| 2 | + |
| 3 | +ENV DATAPLANE_MINOR 3.0.3 |
| 4 | +ENV DATAPLANE_V2_MINOR 2.9.8 |
| 5 | +ENV DATAPLANE_URL https://github.com/haproxytech/dataplaneapi.git |
| 6 | + |
| 7 | +RUN apk add --no-cache ca-certificates git make && \ |
| 8 | + git clone "${DATAPLANE_URL}" "${GOPATH}/src/github.com/haproxytech/dataplaneapi" && \ |
| 9 | + cd "${GOPATH}/src/github.com/haproxytech/dataplaneapi" && \ |
| 10 | + git checkout "v${DATAPLANE_MINOR}" && \ |
| 11 | + make build && cp build/dataplaneapi /dataplaneapi && \ |
| 12 | + make clean && \ |
| 13 | + git checkout "v${DATAPLANE_V2_MINOR}" && \ |
| 14 | + make build && cp build/dataplaneapi /dataplaneapi-v2 |
| 15 | + |
| 16 | +FROM ubuntu:jammy AS openssl-builder |
| 17 | + |
| 18 | +ENV OPENSSL_URL https://github.com/quictls/openssl/archive/refs/tags/openssl-3.3.0-quic1.tar.gz |
| 19 | + |
| 20 | +ENV DEBIAN_FRONTEND noninteractive |
| 21 | + |
| 22 | +RUN apt-get update && \ |
| 23 | + apt-get install -y --no-install-recommends build-essential ca-certificates curl && \ |
| 24 | + curl -sfSL "${OPENSSL_URL}" -o openssl.tar.gz && \ |
| 25 | + mkdir -p /tmp/openssl && \ |
| 26 | + tar -xzf openssl.tar.gz -C /tmp/openssl --strip-components=1 && \ |
| 27 | + rm -f openssl.tar.gz && \ |
| 28 | + cd /tmp/openssl && \ |
| 29 | + ./config --libdir=lib --prefix=/opt/quictls && \ |
| 30 | + make -j $(nproc) && \ |
| 31 | + make install && \ |
| 32 | + rm -rf /tmp/openssl |
| 33 | + |
| 34 | +FROM ubuntu:jammy |
| 35 | + |
| 36 | +MAINTAINER Dinko Korunic < [email protected]> |
| 37 | + |
| 38 | +LABEL Name HAProxy |
| 39 | +LABEL Release Community Edition |
| 40 | +LABEL Vendor HAProxy |
| 41 | +LABEL Version 3.2.0 |
| 42 | +LABEL RUN /usr/bin/docker -d IMAGE |
| 43 | + |
| 44 | +ENV HAPROXY_BRANCH 3.2 |
| 45 | +ENV HAPROXY_MINOR 3.2.0-old |
| 46 | +ENV HAPROXY_SHA256 56a1468574ab411dcabde837f96bea6cf3c2eb90e279469f75ed1dcdc70fce11 |
| 47 | +ENV HAPROXY_SRC_URL http://www.haproxy.org/download |
| 48 | + |
| 49 | +ENV HAPROXY_UID haproxy |
| 50 | +ENV HAPROXY_GID haproxy |
| 51 | + |
| 52 | +ENV DEBIAN_FRONTEND noninteractive |
| 53 | + |
| 54 | +COPY --from=dataplaneapi-builder /dataplaneapi /usr/local/bin/dataplaneapi |
| 55 | +COPY --from=dataplaneapi-builder /dataplaneapi-v2 /usr/local/bin/dataplaneapi-v2 |
| 56 | +COPY --from=openssl-builder /opt/quictls /opt/quictls |
| 57 | + |
| 58 | +RUN apt-get update && \ |
| 59 | + apt-get install -y --no-install-recommends procps zlib1g "libpcre2-*" liblua5.4-0 libatomic1 tar curl socat ca-certificates && \ |
| 60 | + apt-get install -y --no-install-recommends gcc make libc6-dev libpcre3-dev zlib1g-dev liblua5.4-dev && \ |
| 61 | + curl -sfSL "${HAPROXY_SRC_URL}/${HAPROXY_BRANCH}/src/devel/haproxy-${HAPROXY_MINOR}.tar.gz" -o haproxy.tar.gz && \ |
| 62 | + echo "$HAPROXY_SHA256 *haproxy.tar.gz" | sha256sum -c - && \ |
| 63 | + groupadd "$HAPROXY_GID" && \ |
| 64 | + useradd -g "$HAPROXY_GID" "$HAPROXY_UID" && \ |
| 65 | + mkdir -p /tmp/haproxy && \ |
| 66 | + tar -xzf haproxy.tar.gz -C /tmp/haproxy --strip-components=1 && \ |
| 67 | + rm -f haproxy.tar.gz && \ |
| 68 | + make -C /tmp/haproxy -j"$(nproc)" TARGET=linux-glibc CPU=generic USE_PCRE2=1 USE_PCRE2_JIT=1 \ |
| 69 | + USE_TFO=1 USE_LINUX_TPROXY=1 USE_LUA=1 USE_GETADDRINFO=1 \ |
| 70 | + USE_PROMEX=1 USE_SLZ=1 \ |
| 71 | + USE_OPENSSL=1 USE_PTHREAD_EMULATION=1 \ |
| 72 | + SSL_INC=/opt/quictls/include SSL_LIB=/opt/quictls/lib USE_QUIC=1 \ |
| 73 | + LDFLAGS="-L/opt/quictls/lib -Wl,-rpath,/opt/quictls/lib" \ |
| 74 | + all && \ |
| 75 | + make -C /tmp/haproxy TARGET=linux-glibc install-bin install-man && \ |
| 76 | + ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy && \ |
| 77 | + mkdir -p /var/lib/haproxy && \ |
| 78 | + chown "$HAPROXY_UID:$HAPROXY_GID" /var/lib/haproxy && \ |
| 79 | + mkdir -p /usr/local/etc/haproxy && \ |
| 80 | + ln -s /usr/local/etc/haproxy /etc/haproxy && \ |
| 81 | + cp -R /tmp/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors && \ |
| 82 | + rm -rf /tmp/haproxy && \ |
| 83 | + apt-get purge -y --auto-remove gcc make libc6-dev libpcre2-dev zlib1g-dev liblua5.4-dev && \ |
| 84 | + apt-get clean && \ |
| 85 | + rm -rf /var/lib/apt/lists/* && \ |
| 86 | + chmod +x /usr/local/bin/dataplaneapi && \ |
| 87 | + ln -s /usr/local/bin/dataplaneapi /usr/bin/dataplaneapi && \ |
| 88 | + chmod +x /usr/local/bin/dataplaneapi-v2 && \ |
| 89 | + ln -s /usr/local/bin/dataplaneapi-v2 /usr/bin/dataplaneapi-v2 && \ |
| 90 | + touch /usr/local/etc/haproxy/dataplaneapi.yml && \ |
| 91 | + chown "$HAPROXY_UID:$HAPROXY_GID" /usr/local/etc/haproxy/dataplaneapi.yml && \ |
| 92 | + echo "/opt/quictls/lib" > /etc/ld.so.conf.d/quictls.conf && \ |
| 93 | + mkdir -p /opt/quictls/ssl && \ |
| 94 | + rm -rf /opt/quictls/ssl/certs && \ |
| 95 | + ln -s /etc/ssl/certs /opt/quictls/ssl/certs && \ |
| 96 | + ldconfig |
| 97 | + |
| 98 | +COPY haproxy.cfg /usr/local/etc/haproxy |
| 99 | +COPY docker-entrypoint.sh / |
| 100 | + |
| 101 | +STOPSIGNAL SIGUSR1 |
| 102 | + |
| 103 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
| 104 | +CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] |
0 commit comments