|
| 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 alpine:3.20 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 | +RUN apk add --no-cache curl build-base make autoconf automake gcc libc-dev linux-headers && \ |
| 21 | + curl -sfSL "${OPENSSL_URL}" -o openssl.tar.gz && \ |
| 22 | + mkdir -p /tmp/openssl && \ |
| 23 | + tar -xzf openssl.tar.gz -C /tmp/openssl --strip-components=1 && \ |
| 24 | + rm -f openssl.tar.gz && \ |
| 25 | + cd /tmp/openssl && \ |
| 26 | + ./config --libdir=lib --prefix=/opt/quictls && \ |
| 27 | + make -j $(nproc) && \ |
| 28 | + make install && \ |
| 29 | + rm -rf /tmp/openssl |
| 30 | + |
| 31 | +FROM alpine:3.20 |
| 32 | + |
| 33 | +MAINTAINER Dinko Korunic <dkorunic@haproxy.com> |
| 34 | + |
| 35 | +LABEL Name HAProxy |
| 36 | +LABEL Release Community Edition |
| 37 | +LABEL Vendor HAProxy |
| 38 | +LABEL Version 3.2.0 |
| 39 | +LABEL RUN /usr/bin/docker -d IMAGE |
| 40 | + |
| 41 | +ENV HAPROXY_BRANCH 3.2 |
| 42 | +ENV HAPROXY_MINOR 3.2.0-old |
| 43 | +ENV HAPROXY_SHA256 56a1468574ab411dcabde837f96bea6cf3c2eb90e279469f75ed1dcdc70fce11 |
| 44 | +ENV HAPROXY_SRC_URL http://www.haproxy.org/download |
| 45 | + |
| 46 | +ENV HAPROXY_UID haproxy |
| 47 | +ENV HAPROXY_GID haproxy |
| 48 | + |
| 49 | +COPY --from=dataplaneapi-builder /dataplaneapi /usr/local/bin/dataplaneapi |
| 50 | +COPY --from=dataplaneapi-builder /dataplaneapi-v2 /usr/local/bin/dataplaneapi-v2 |
| 51 | +COPY --from=openssl-builder /opt/quictls /opt/quictls |
| 52 | + |
| 53 | +RUN apk add --no-cache ca-certificates && \ |
| 54 | + apk add --no-cache --virtual build-deps gcc libc-dev \ |
| 55 | + linux-headers lua5.4-dev make openssl openssl-dev pcre2-dev tar \ |
| 56 | + zlib-dev curl shadow && \ |
| 57 | + curl -sfSL "${HAPROXY_SRC_URL}/${HAPROXY_BRANCH}/src/devel/haproxy-${HAPROXY_MINOR}.tar.gz" -o haproxy.tar.gz && \ |
| 58 | + echo "$HAPROXY_SHA256 *haproxy.tar.gz" | sha256sum -c - && \ |
| 59 | + groupadd "$HAPROXY_GID" && \ |
| 60 | + useradd -g "$HAPROXY_GID" "$HAPROXY_UID" && \ |
| 61 | + mkdir -p /tmp/haproxy && \ |
| 62 | + tar -xzf haproxy.tar.gz -C /tmp/haproxy --strip-components=1 && \ |
| 63 | + rm -f haproxy.tar.gz && \ |
| 64 | + make -C /tmp/haproxy -j"$(nproc)" TARGET=linux-musl CPU=generic USE_PCRE2=1 USE_PCRE2_JIT=1 \ |
| 65 | + USE_TFO=1 USE_LINUX_TPROXY=1 USE_GETADDRINFO=1 \ |
| 66 | + USE_LUA=1 LUA_LIB=/usr/lib/lua5.4 LUA_INC=/usr/include/lua5.4 \ |
| 67 | + USE_PROMEX=1 USE_SLZ=1 \ |
| 68 | + USE_OPENSSL=1 USE_PTHREAD_EMULATION=1 \ |
| 69 | + SSL_INC=/opt/quictls/include SSL_LIB=/opt/quictls/lib USE_QUIC=1 \ |
| 70 | + LDFLAGS="-L/opt/quictls/lib -Wl,-rpath,/opt/quictls/lib" \ |
| 71 | + all && \ |
| 72 | + make -C /tmp/haproxy TARGET=linux2628 install-bin install-man && \ |
| 73 | + ln -s /usr/local/sbin/haproxy /usr/sbin/haproxy && \ |
| 74 | + mkdir -p /var/lib/haproxy && \ |
| 75 | + chown "$HAPROXY_UID:$HAPROXY_GID" /var/lib/haproxy && \ |
| 76 | + mkdir -p /usr/local/etc/haproxy && \ |
| 77 | + ln -s /usr/local/etc/haproxy /etc/haproxy && \ |
| 78 | + cp -R /tmp/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors && \ |
| 79 | + rm -rf /tmp/haproxy && \ |
| 80 | + chmod +x /usr/local/bin/dataplaneapi && \ |
| 81 | + ln -s /usr/local/bin/dataplaneapi /usr/bin/dataplaneapi && \ |
| 82 | + chmod +x /usr/local/bin/dataplaneapi-v2 && \ |
| 83 | + ln -s /usr/local/bin/dataplaneapi-v2 /usr/bin/dataplaneapi-v2 && \ |
| 84 | + touch /usr/local/etc/haproxy/dataplaneapi.yml && \ |
| 85 | + chown "$HAPROXY_UID:$HAPROXY_GID" /usr/local/etc/haproxy/dataplaneapi.yml && \ |
| 86 | + apk del build-deps && \ |
| 87 | + apk add --no-cache openssl zlib lua5.4-libs pcre2 && \ |
| 88 | + rm -f /var/cache/apk/* && \ |
| 89 | + echo "/lib:/usr/local/lib:/usr/lib:/opt/quictls/lib" > "/etc/ld-musl-$(uname -m).path" && \ |
| 90 | + mkdir -p /opt/quictls/ssl && \ |
| 91 | + rm -rf /opt/quictls/ssl/certs && \ |
| 92 | + ln -s /etc/ssl/certs /opt/quictls/ssl/certs |
| 93 | + |
| 94 | +COPY haproxy.cfg /usr/local/etc/haproxy |
| 95 | +COPY docker-entrypoint.sh / |
| 96 | + |
| 97 | +STOPSIGNAL SIGUSR1 |
| 98 | + |
| 99 | +ENTRYPOINT ["/docker-entrypoint.sh"] |
| 100 | +CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] |
0 commit comments