diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template
index 3d6236e6e8a206284cfc85ace033fdea62106c4a..767923f8956883a794dce0a86aee39fdc506cd89 100644
--- a/Dockerfile-alpine.template
+++ b/Dockerfile-alpine.template
@@ -38,7 +38,7 @@ RUN set -eux; \
 # verify that the binary works
 	gosu --version; \
 	gosu nobody true
-{{ if [ "12", "13", "14", "15", "16" ] | index(env.version) then ( -}}
+{{ if env.version | IN("12", "13", "14", "15", "16") then ( -}}
 RUN set -eux; ln -svf gosu /usr/local/bin/su-exec; su-exec nobody true # backwards compatibility (removed in PostgreSQL 17+)
 {{ ) else "" end -}}