1
0
mirror of https://github.com/docker-library/haproxy.git synced 2025-04-19 10:42:17 +03:00

Use jq's IN() instead of index()

The end result is the same, but the construction is more ergonomic.
This commit is contained in:
Tianon Gravi 2024-10-16 14:57:38 -07:00
parent a2995ab1ba
commit f9b92d61e5
2 changed files with 10 additions and 10 deletions

View File

@ -59,7 +59,7 @@ ENV HAPROXY_SHA256 {{ .sha256 }}
# Since 5.4 is supported on haproxy, better use it now, but only for
# newer versions since there could be some minor incompatibilities
# for existing scripts: https://www.lua.org/manual/5.4/manual.html#8
if ([ "2.2", "2.4", "2.6", "2.8" ] | index(env.version)) then
if env.version | IN("2.2", "2.4", "2.6", "2.8") then
"5.3"
else
"5.4"
@ -81,7 +81,7 @@ RUN set -eux; \
pcre2-dev \
readline-dev \
tar \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
zlib-dev \
{{ ) else "" end -}}
; \
@ -95,7 +95,7 @@ RUN set -eux; \
libssl-dev \
make \
wget \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
zlib1g-dev \
{{ ) else "" end -}}
; \
@ -122,15 +122,15 @@ RUN set -eux; \
USE_LUA=1 LUA_INC=/usr/include/lua{{ lua }}{{ if env.variant == "alpine" then (" LUA_LIB=/usr/lib/lua" + lua) else "" end }} \
USE_OPENSSL=1 \
USE_PCRE2=1 USE_PCRE2_JIT=1 \
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
{{ if env.version == "2.2" then ( -}}
USE_ZLIB=1 \
{{ ) else "" end -}}
{{ if ([ "2.2" ] | index(env.version) | not) then ( -}}
{{ if env.version == "2.2" then "" else ( -}}
USE_PROMEX=1 \
{{ ) else "" end -}}
{{ ) end -}}
\
EXTRA_OBJS=" \
{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
# see https://github.com/docker-library/haproxy/issues/94#issuecomment-505673353 for more details about prometheus support
contrib/prometheus-exporter/service-prometheus.o \
{{ ) else "" end -}}
@ -188,12 +188,12 @@ RUN set -eux; \
STOPSIGNAL SIGUSR1
COPY docker-entrypoint.sh /usr/local/bin/
{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
{{ ) else "" end -}}
ENTRYPOINT ["docker-entrypoint.sh"]
{{ if [ "2.2" ] | index(env.version) then ( -}}
{{ if env.version == "2.2" then ( -}}
# no USER for backwards compatibility (to try to avoid breaking existing users)
{{ ) else ( -}}
USER haproxy

View File

@ -37,7 +37,7 @@ for version in "${versions[@]}"; do
alpine: env.alpine,
}
# remove Alpine from versions where it cannot be built on any active Alpine release
| if [ "2.2" ] | index(env.version) then del(.alpine) else . end
| if env.version == "2.2" then del(.alpine) else . end
'
)"