Skip to content

Commit 7dce106

Browse files
authored
Merge pull request #235 from docker-library/jq-IN
Use jq's `IN()` instead of `index()`
2 parents a2995ab + f9b92d6 commit 7dce106

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Diff for: Dockerfile.template

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ENV HAPROXY_SHA256 {{ .sha256 }}
5959
# Since 5.4 is supported on haproxy, better use it now, but only for
6060
# newer versions since there could be some minor incompatibilities
6161
# for existing scripts: https://www.lua.org/manual/5.4/manual.html#8
62-
if ([ "2.2", "2.4", "2.6", "2.8" ] | index(env.version)) then
62+
if env.version | IN("2.2", "2.4", "2.6", "2.8") then
6363
"5.3"
6464
else
6565
"5.4"
@@ -81,7 +81,7 @@ RUN set -eux; \
8181
pcre2-dev \
8282
readline-dev \
8383
tar \
84-
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
84+
{{ if env.version == "2.2" then ( -}}
8585
zlib-dev \
8686
{{ ) else "" end -}}
8787
; \
@@ -95,7 +95,7 @@ RUN set -eux; \
9595
libssl-dev \
9696
make \
9797
wget \
98-
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
98+
{{ if env.version == "2.2" then ( -}}
9999
zlib1g-dev \
100100
{{ ) else "" end -}}
101101
; \
@@ -122,15 +122,15 @@ RUN set -eux; \
122122
USE_LUA=1 LUA_INC=/usr/include/lua{{ lua }}{{ if env.variant == "alpine" then (" LUA_LIB=/usr/lib/lua" + lua) else "" end }} \
123123
USE_OPENSSL=1 \
124124
USE_PCRE2=1 USE_PCRE2_JIT=1 \
125-
{{ if ([ "2.2" ] | index(env.version)) then ( -}}
125+
{{ if env.version == "2.2" then ( -}}
126126
USE_ZLIB=1 \
127127
{{ ) else "" end -}}
128-
{{ if ([ "2.2" ] | index(env.version) | not) then ( -}}
128+
{{ if env.version == "2.2" then "" else ( -}}
129129
USE_PROMEX=1 \
130-
{{ ) else "" end -}}
130+
{{ ) end -}}
131131
\
132132
EXTRA_OBJS=" \
133-
{{ if [ "2.2" ] | index(env.version) then ( -}}
133+
{{ if env.version == "2.2" then ( -}}
134134
# see https://github.com/docker-library/haproxy/issues/94#issuecomment-505673353 for more details about prometheus support
135135
contrib/prometheus-exporter/service-prometheus.o \
136136
{{ ) else "" end -}}
@@ -188,12 +188,12 @@ RUN set -eux; \
188188
STOPSIGNAL SIGUSR1
189189

190190
COPY docker-entrypoint.sh /usr/local/bin/
191-
{{ if [ "2.2" ] | index(env.version) then ( -}}
191+
{{ if env.version == "2.2" then ( -}}
192192
RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
193193
{{ ) else "" end -}}
194194
ENTRYPOINT ["docker-entrypoint.sh"]
195195

196-
{{ if [ "2.2" ] | index(env.version) then ( -}}
196+
{{ if env.version == "2.2" then ( -}}
197197
# no USER for backwards compatibility (to try to avoid breaking existing users)
198198
{{ ) else ( -}}
199199
USER haproxy

Diff for: versions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ for version in "${versions[@]}"; do
3737
alpine: env.alpine,
3838
}
3939
# remove Alpine from versions where it cannot be built on any active Alpine release
40-
| if [ "2.2" ] | index(env.version) then del(.alpine) else . end
40+
| if env.version == "2.2" then del(.alpine) else . end
4141
'
4242
)"
4343

0 commit comments

Comments
 (0)