From 82ff028a25c55c36e8c39b16390e4e04efa2bc4a Mon Sep 17 00:00:00 2001 From: ToadCast Date: Tue, 24 Nov 2020 11:41:38 +0100 Subject: [PATCH] Add system user to avoid running container with root For backwards compatilibity, we only set the new user as default in the 2.4 pre-releases. --- 1.7/Dockerfile | 17 +++++++++++++++-- 1.7/alpine/Dockerfile | 18 ++++++++++++++++-- 1.8/Dockerfile | 17 +++++++++++++++-- 1.8/alpine/Dockerfile | 18 ++++++++++++++++-- 2.0/Dockerfile | 17 +++++++++++++++-- 2.0/alpine/Dockerfile | 18 ++++++++++++++++-- 2.1/Dockerfile | 17 +++++++++++++++-- 2.1/alpine/Dockerfile | 18 ++++++++++++++++-- 2.2/Dockerfile | 17 +++++++++++++++-- 2.2/alpine/Dockerfile | 18 ++++++++++++++++-- 2.3/Dockerfile | 17 +++++++++++++++-- 2.3/alpine/Dockerfile | 18 ++++++++++++++++-- 2.4-rc/Dockerfile | 17 +++++++++++++++-- 2.4-rc/alpine/Dockerfile | 18 ++++++++++++++++-- Dockerfile-alpine.template | 19 +++++++++++++++++-- Dockerfile-debian.template | 18 ++++++++++++++++-- update.sh | 13 +++++++++++++ 17 files changed, 263 insertions(+), 32 deletions(-) diff --git a/1.7/Dockerfile b/1.7/Dockerfile index 43408da..781925e 100644 --- a/1.7/Dockerfile +++ b/1.7/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 1.7.12 ENV HAPROXY_URL https://www.haproxy.org/download/1.7/src/haproxy-1.7.12.tar.gz ENV HAPROXY_SHA256 4118178b553a107b227f3f84774c7a50ae0b3ac2be39211c3db511ed4efe48ce @@ -71,6 +82,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.7/alpine/Dockerfile b/1.7/alpine/Dockerfile index b4e17ac..a1f6590 100644 --- a/1.7/alpine/Dockerfile +++ b/1.7/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 1.7.12 ENV HAPROXY_URL https://www.haproxy.org/download/1.7/src/haproxy-1.7.12.tar.gz ENV HAPROXY_SHA256 4118178b553a107b227f3f84774c7a50ae0b3ac2be39211c3db511ed4efe48ce @@ -62,6 +74,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.8/Dockerfile b/1.8/Dockerfile index e2a48cd..70e8a79 100644 --- a/1.8/Dockerfile +++ b/1.8/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 1.8.27 ENV HAPROXY_URL https://www.haproxy.org/download/1.8/src/haproxy-1.8.27.tar.gz ENV HAPROXY_SHA256 56ba6a21e13215fae56472ad37d5d68c3f19bde9da94c59e70b869eecf48bf50 @@ -71,6 +82,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/1.8/alpine/Dockerfile b/1.8/alpine/Dockerfile index 3b1b891..1a75bdb 100644 --- a/1.8/alpine/Dockerfile +++ b/1.8/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 1.8.27 ENV HAPROXY_URL https://www.haproxy.org/download/1.8/src/haproxy-1.8.27.tar.gz ENV HAPROXY_SHA256 56ba6a21e13215fae56472ad37d5d68c3f19bde9da94c59e70b869eecf48bf50 @@ -61,6 +73,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.0/Dockerfile b/2.0/Dockerfile index 029e156..a30e5e7 100644 --- a/2.0/Dockerfile +++ b/2.0/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.0.19 ENV HAPROXY_URL https://www.haproxy.org/download/2.0/src/haproxy-2.0.19.tar.gz ENV HAPROXY_SHA256 dcc444ac0aca0917e289653134333f7c29d05d844e6cd60dd04e23b5ff80c92d @@ -73,6 +84,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.0/alpine/Dockerfile b/2.0/alpine/Dockerfile index 0346838..4e4293c 100644 --- a/2.0/alpine/Dockerfile +++ b/2.0/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.0.19 ENV HAPROXY_URL https://www.haproxy.org/download/2.0/src/haproxy-2.0.19.tar.gz ENV HAPROXY_SHA256 dcc444ac0aca0917e289653134333f7c29d05d844e6cd60dd04e23b5ff80c92d @@ -63,6 +75,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.1/Dockerfile b/2.1/Dockerfile index a18faa0..18769c2 100644 --- a/2.1/Dockerfile +++ b/2.1/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.1.10 ENV HAPROXY_URL https://www.haproxy.org/download/2.1/src/haproxy-2.1.10.tar.gz ENV HAPROXY_SHA256 d245a06145d1d0cbe62681de84bc23dfc98afe10f8cc5c1422a447722a142a41 @@ -73,6 +84,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.1/alpine/Dockerfile b/2.1/alpine/Dockerfile index c4b463d..587df34 100644 --- a/2.1/alpine/Dockerfile +++ b/2.1/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.1.10 ENV HAPROXY_URL https://www.haproxy.org/download/2.1/src/haproxy-2.1.10.tar.gz ENV HAPROXY_SHA256 d245a06145d1d0cbe62681de84bc23dfc98afe10f8cc5c1422a447722a142a41 @@ -63,6 +75,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.2/Dockerfile b/2.2/Dockerfile index fb16c5c..05fd533 100644 --- a/2.2/Dockerfile +++ b/2.2/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.2.6 ENV HAPROXY_URL https://www.haproxy.org/download/2.2/src/haproxy-2.2.6.tar.gz ENV HAPROXY_SHA256 be1c6754cbaceafc4837e0c6036c7f81027a3992516435cbbbc5dc749bf5a087 @@ -73,6 +84,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.2/alpine/Dockerfile b/2.2/alpine/Dockerfile index c32f85b..fcae580 100644 --- a/2.2/alpine/Dockerfile +++ b/2.2/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.2.6 ENV HAPROXY_URL https://www.haproxy.org/download/2.2/src/haproxy-2.2.6.tar.gz ENV HAPROXY_SHA256 be1c6754cbaceafc4837e0c6036c7f81027a3992516435cbbbc5dc749bf5a087 @@ -63,6 +75,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.3/Dockerfile b/2.3/Dockerfile index 6ff7d16..37e7ddd 100644 --- a/2.3/Dockerfile +++ b/2.3/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.3.2 ENV HAPROXY_URL https://www.haproxy.org/download/2.3/src/haproxy-2.3.2.tar.gz ENV HAPROXY_SHA256 99cb73bb791a2cd18898d0595e14fdc820a6cbd622c762f4ed83f2884d038fd5 @@ -73,6 +84,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.3/alpine/Dockerfile b/2.3/alpine/Dockerfile index e250602..2eae8a0 100644 --- a/2.3/alpine/Dockerfile +++ b/2.3/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.3.2 ENV HAPROXY_URL https://www.haproxy.org/download/2.3/src/haproxy-2.3.2.tar.gz ENV HAPROXY_SHA256 99cb73bb791a2cd18898d0595e14fdc820a6cbd622c762f4ed83f2884d038fd5 @@ -63,6 +75,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.4-rc/Dockerfile b/2.4-rc/Dockerfile index dc66368..c2f83fa 100644 --- a/2.4-rc/Dockerfile +++ b/2.4-rc/Dockerfile @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:buster-slim +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.4-dev4 ENV HAPROXY_URL https://www.haproxy.org/download/2.4/src/devel/haproxy-2.4-dev4.tar.gz ENV HAPROXY_SHA256 be583c7058e0dff02b59ce575e5492b4b6b48d8fd176370312fcada807479c0f @@ -73,6 +84,8 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +USER haproxy CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/2.4-rc/alpine/Dockerfile b/2.4-rc/alpine/Dockerfile index 48c014b..cc0e869 100644 --- a/2.4-rc/alpine/Dockerfile +++ b/2.4-rc/alpine/Dockerfile @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:3.12 +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION 2.4-dev4 ENV HAPROXY_URL https://www.haproxy.org/download/2.4/src/devel/haproxy-2.4-dev4.tar.gz ENV HAPROXY_SHA256 be583c7058e0dff02b59ce575e5492b4b6b48d8fd176370312fcada807479c0f @@ -63,6 +75,8 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] + +USER haproxy CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 7a0f75f..4f3134f 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,6 +1,18 @@ # vim:set ft=dockerfile: FROM alpine:%%ALPINE_VERSION%% +# roughly, https://git.alpinelinux.org/aports/tree/main/haproxy/haproxy.pre-install?h=3.12-stable +RUN set -eux; \ + addgroup --gid 99 --system haproxy; \ + adduser \ + --disabled-password \ + --home /var/lib/haproxy \ + --ingroup haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION %%HAPROXY_VERSION%% ENV HAPROXY_URL %%HAPROXY_URL%% ENV HAPROXY_SHA256 %%HAPROXY_SHA256%% @@ -63,6 +75,9 @@ RUN set -x \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + +USER haproxy CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 4001455..9462495 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -1,6 +1,17 @@ # vim:set ft=dockerfile: FROM debian:%%DEBIAN_VERSION%% +# roughly, https://salsa.debian.org/haproxy-team/haproxy/-/blob/732b97ae286906dea19ab5744cf9cf97c364ac1d/debian/haproxy.postinst#L5-6 +RUN set -eux; \ + groupadd --gid 99 --system haproxy; \ + useradd \ + --gid haproxy \ + --home-dir /var/lib/haproxy \ + --no-create-home \ + --system \ + --uid 99 \ + haproxy + ENV HAPROXY_VERSION %%HAPROXY_VERSION%% ENV HAPROXY_URL %%HAPROXY_URL%% ENV HAPROXY_SHA256 %%HAPROXY_SHA256%% @@ -73,6 +84,9 @@ RUN set -eux; \ # "graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process" STOPSIGNAL SIGUSR1 -COPY docker-entrypoint.sh / -ENTRYPOINT ["/docker-entrypoint.sh"] +COPY docker-entrypoint.sh /usr/local/bin/ +RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat +ENTRYPOINT ["docker-entrypoint.sh"] + +USER haproxy CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"] diff --git a/update.sh b/update.sh index ba6eca1..632af18 100755 --- a/update.sh +++ b/update.sh @@ -69,6 +69,19 @@ for version in "${versions[@]}"; do s/linux-musl/linux-glibc/; ' fi + case "$version" in + 1.* | 2.0 | 2.1 | 2.2 | 2.3) + # backwards compatibility (to try to avoid breaking existing users) + sedExpr+=' + /^USER /d + ' + ;; + *) + sedExpr+=' + /backwards compat/d + ' + ;; + esac sed -r "$sedExpr" 'Dockerfile-debian.template' > "$version/Dockerfile" for variant in alpine; do