This commit is contained in:
2022-06-18 22:54:30 +02:00
parent e868b6112f
commit 0507369910
2 changed files with 78 additions and 6 deletions

View File

@@ -66,6 +66,78 @@ RUN \
rm -f -r \
/tmp/*
RUN set -eux; \
addgroup --gid 99 --system haproxy; \
adduser \
--disabled-password \
--home /var/lib/haproxy \
--ingroup haproxy \
--no-create-home \
--system \
--uid 99 \
haproxy \
; \
mkdir /var/lib/haproxy; \
chown haproxy:haproxy /var/lib/haproxy
ENV HAPROXY_VERSION 2.6.0
ENV HAPROXY_URL https://www.haproxy.org/download/2.6/src/haproxy-2.6.0.tar.gz
ENV HAPROXY_SHA256 90f8e608aacd513b0f542e0438fa12e7fb4622cf58bd4375f3fe0350146eaa59
RUN set -eux; \
\
apk add --no-cache --virtual .build-deps \
gcc \
libc-dev \
linux-headers \
lua5.3-dev \
make \
openssl \
openssl-dev \
pcre2-dev \
readline-dev \
tar \
; \
\
wget -O haproxy.tar.gz "$HAPROXY_URL"; \
echo "$HAPROXY_SHA256 *haproxy.tar.gz" | sha256sum -c; \
mkdir -p /usr/src/haproxy; \
tar -xzf haproxy.tar.gz -C /usr/src/haproxy --strip-components=1; \
rm haproxy.tar.gz; \
\
makeOpts=' \
TARGET=linux-musl \
USE_GETADDRINFO=1 \
USE_LUA=1 LUA_INC=/usr/include/lua5.3 LUA_LIB=/usr/lib/lua5.3 \
USE_OPENSSL=1 \
USE_PCRE2=1 USE_PCRE2_JIT=1 \
USE_PROMEX=1 \
\
EXTRA_OBJS=" \
" \
'; \
\
nproc="$(getconf _NPROCESSORS_ONLN)"; \
eval "make -C /usr/src/haproxy -j '$nproc' all $makeOpts"; \
eval "make -C /usr/src/haproxy install-bin $makeOpts"; \
\
mkdir -p /usr/local/etc/haproxy; \
cp -R /usr/src/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors; \
rm -rf /usr/src/haproxy; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-network --virtual .haproxy-rundeps $runDeps; \
apk del --no-network .build-deps; \
\
haproxy -v
STOPSIGNAL SIGUSR1
ENV ALLOW_RESTARTS=0 \
AUTH=0 \
BUILD=0 \
@@ -100,7 +172,7 @@ EXPOSE 2375
COPY entrypoint.sh /entrypoint.sh
COPY settings.sh /settings.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["telegraf"]
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
# Labels
LABEL \