ARG BUILD_FROM FROM ${BUILD_FROM} # Build arguments ARG BUILD_ARCH ARG BUILD_DATE ARG BUILD_DESCRIPTION ARG BUILD_NAME ARG BUILD_REF ARG BUILD_REPOSITORY ARG BUILD_VERSION ARG TELEGRAF_VERSION ARG BASHIO_VERSION ARG TEMPIO_VERSION # Environment variables ENV \ CARGO_NET_GIT_FETCH_WITH_CLI=true \ HOME="/root" \ LANG="C.UTF-8" \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ PIP_FIND_LINKS=https://wheels.home-assistant.io/musllinux/ \ PIP_NO_CACHE_DIR=1 \ PIP_PREFER_BINARY=1 \ PS1="$(whoami)@$(hostname):$(pwd)$ " \ PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ YARN_HTTP_TIMEOUT=1000000 \ TERM="xterm-256color" # Copy root filesystem COPY rootfs / # Set shell SHELL ["/bin/ash", "-o", "pipefail", "-c"] USER root RUN \ set -o pipefail && \ apk add --no-cache --virtual .build-dependencies \ tar=1.34-r0 \ xz=5.2.5-r1 && \ apk add --no-cache \ libcrypto1.1=1.1.1o-r0 \ libssl1.1=1.1.1o-r0 \ musl-utils=1.2.3-r0 \ musl=1.2.3-r0 && \ apk add --no-cache \ bash=5.1.16-r2 \ curl=7.83.1-r1 \ jq=1.6-r1 \ tzdata=2022a-r0 && \ curl -J -L -o /tmp/bashio.tar.gz \ "https://github.com/hassio-addons/bashio/archive/v0.14.3.tar.gz" && \ mkdir /tmp/bashio && \ tar zxvf \ /tmp/bashio.tar.gz \ --strip 1 -C /tmp/bashio && \ mv /tmp/bashio/lib /usr/lib/bashio && \ ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \ curl -L -s -o /usr/bin/tempio \ "https://github.com/home-assistant/tempio/releases/download/2021.09.0/tempio_${BUILD_ARCH}" && \ chmod a+x /usr/bin/tempio && \ apk del --no-cache --purge .build-dependencies && \ 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 \ COMMIT=0 \ CONFIGS=0 \ CONTAINERS=0 \ DISTRIBUTION=0 \ EVENTS=1 \ EXEC=0 \ GRPC=0 \ IMAGES=0 \ INFO=0 \ LOG_LEVEL=info \ NETWORKS=0 \ NODES=0 \ PING=1 \ PLUGINS=0 \ POST=0 \ SECRETS=0 \ SERVICES=0 \ SESSION=0 \ SOCKET_PATH=/var/run/docker.sock \ SWARM=0 \ SYSTEM=0 \ TASKS=0 \ VERSION=1 \ VOLUMES=0 COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg EXPOSE 2375 COPY entrypoint.sh /entrypoint.sh COPY settings.sh /settings.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] # Labels LABEL \ io.hass.name="${BUILD_NAME}" \ io.hass.description="${BUILD_DESCRIPTION}" \ io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ io.hass.version=${BUILD_VERSION} \ maintainer="fbonelle" \ org.opencontainers.image.title="${BUILD_NAME}" \ org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ org.opencontainers.image.vendor="fbonelle's addons" \ org.opencontainers.image.authors="fbonelle" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.created=${BUILD_DATE} \ org.opencontainers.image.revision=${BUILD_REF} \ org.opencontainers.image.version=${BUILD_VERSION}