Skip to content

Commit fa5d16b

Browse files
authored
Merge pull request #232 from infosiftr/restore-2.0
Restore 2.0 (not yet EOL)
2 parents 67485bd + 7eb71e6 commit fa5d16b

File tree

8 files changed

+175
-15
lines changed

8 files changed

+175
-15
lines changed

2.0/Dockerfile

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2.0/docker-entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
if [ "${1#-}" != "$1" ]; then
6+
set -- haproxy "$@"
7+
fi
8+
9+
if [ "$1" = 'haproxy' ]; then
10+
shift # "haproxy"
11+
# if the user wants "haproxy", let's add a couple useful flags
12+
# -W -- "master-worker mode" (similar to the old "haproxy-systemd-wrapper"; allows for reload via "SIGUSR2")
13+
# -db -- disables background mode
14+
set -- haproxy -W -db "$@"
15+
fi
16+
17+
exec "$@"

Dockerfile.template

Lines changed: 10 additions & 10 deletions
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 ([ "2.0", "2.2", "2.4", "2.6", "2.8" ] | index(env.version)) 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 ([ "2.0", "2.2" ] | index(env.version)) 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 ([ "2.0", "2.2" ] | index(env.version)) then ( -}}
9999
zlib1g-dev \
100100
{{ ) else "" end -}}
101101
; \
@@ -110,7 +110,7 @@ RUN set -eux; \
110110
\
111111
{{
112112
def haproxy_target:
113-
if env.variant == "alpine" then
113+
if env.variant == "alpine" and env.version != "2.0" then
114114
"linux-musl"
115115
else
116116
"linux-glibc"
@@ -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 ([ "2.0", "2.2" ] | index(env.version)) then ( -}}
126126
USE_ZLIB=1 \
127127
{{ ) else "" end -}}
128-
{{ if ([ "2.2" ] | index(env.version) | not) then ( -}}
128+
{{ if ([ "2.0", "2.2" ] | index(env.version) | not) then ( -}}
129129
USE_PROMEX=1 \
130130
{{ ) else "" end -}}
131131
\
132132
EXTRA_OBJS=" \
133-
{{ if [ "2.2" ] | index(env.version) then ( -}}
133+
{{ if [ "2.0", "2.2" ] | index(env.version) 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,18 +188,18 @@ 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 [ "2.0", "2.2" ] | index(env.version) 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 [ "2.0", "2.2" ] | index(env.version) then ( -}}
197197
# no USER for backwards compatibility (to try to avoid breaking existing users)
198198
{{ ) else ( -}}
199199
USER haproxy
200200
{{ ) end -}}
201201

202-
{{ if [ "2.2", "2.4", "2.6" ] | index(env.version) then ( -}}
202+
{{ if [ "2.0", "2.2", "2.4", "2.6" ] | index(env.version) then ( -}}
203203
# no WORKDIR for backwards compatibility (to try to avoid breaking existing users)
204204
{{ ) else ( -}}
205205
# https://github.com/docker-library/haproxy/issues/200

apply-templates.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,26 @@ generated_warning() {
2828
}
2929

3030
for version; do
31+
rm -rf "$version/"
32+
3133
for variant in '' alpine; do
32-
# 2.2 can't be built on Alpine greater than 3.16
34+
# 2.0, 2.2 can't be built on Alpine greater than 3.16
3335
# OpenSSL 3 incompatibilities (https://github.com/haproxy/haproxy/issues/1276)
3436
# but Alpine 3.16 is end of life
35-
if [ "$version" = '2.2' ] && [ "$variant" = 'alpine' ]; then
37+
if { [ "$version" = '2.0' ] || [ "$version" = '2.2' ]; } && [ "$variant" = 'alpine' ]; then
3638
continue
3739
fi
3840
export version variant
3941
dir="$version${variant:+/$variant}"
4042

4143
echo "processing $dir ..."
44+
mkdir -p "$dir"
4245

4346
{
4447
generated_warning
4548
gawk -f "$jqt" Dockerfile.template
4649
} > "$dir/Dockerfile"
50+
51+
cp -a docker-entrypoint.sh "$dir/"
4752
done
4853
done

docker-entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option`
5+
if [ "${1#-}" != "$1" ]; then
6+
set -- haproxy "$@"
7+
fi
8+
9+
if [ "$1" = 'haproxy' ]; then
10+
shift # "haproxy"
11+
# if the user wants "haproxy", let's add a couple useful flags
12+
# -W -- "master-worker mode" (similar to the old "haproxy-systemd-wrapper"; allows for reload via "SIGUSR2")
13+
# -db -- disables background mode
14+
set -- haproxy -W -db "$@"
15+
fi
16+
17+
exec "$@"

generate-stackbrew-library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ for version; do
9292
export variant
9393
dir="$version${variant:+/$variant}"
9494
if [ ! -d "$dir" ]; then
95-
# 2.2 can't be built on supported Alpine release, so it has no Alpine
95+
# 2.0, 2.2 can't be built on a supported Alpine release
9696
continue
9797
fi
9898

versions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"2.0": {
3+
"debian": "buster-slim",
4+
"sha256": "95334c52ace9ae139e66d60240633be8bb4eed1babedfcc6cb947092e00c447c",
5+
"url": "https://www.haproxy.org/download/2.0/src/haproxy-2.0.35.tar.gz",
6+
"version": "2.0.35"
7+
},
28
"2.2": {
39
"debian": "bullseye-slim",
410
"sha256": "24f9eec04ee8d9e3652370be3db9852dec8aa650b3c8eeae969300c86b6fda5b",

versions.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ versions=( "${versions[@]%/}" )
1515
defaultDebianSuite='bookworm-slim'
1616
declare -A debianSuite=(
1717
[2.2]='bullseye-slim'
18+
[2.0]='buster-slim'
1819
)
1920
defaultAlpineVersion='3.20'
2021
declare -A alpineVersion=(
@@ -36,8 +37,8 @@ for version in "${versions[@]}"; do
3637
debian: env.debian,
3738
alpine: env.alpine,
3839
}
39-
# remove Alpine from 2.2 since it cannot be built on any active Alpine release
40-
| if env.version == "2.2" then del(.alpine) else . end
40+
# remove Alpine from versions where it cannot be built on any active Alpine release
41+
| if [ "2.0", "2.2" ] | index(env.version) then del(.alpine) else . end
4142
'
4243
)"
4344

0 commit comments

Comments
 (0)