Skip to content

Commit 5eca4a0

Browse files
authored
Merge pull request #474 from infosiftr/alpine-1.21-upstream
Use upstream binaries for Alpine in 1.21+
2 parents bba543a + 0ac27a1 commit 5eca4a0

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

1.21-rc/alpine3.17/Dockerfile

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

1.21-rc/alpine3.18/Dockerfile

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

Dockerfile-linux.template

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
;
55
def alpine_version:
66
env.variant | ltrimstr("alpine")
7+
;
8+
def always_build_from_source:
9+
# https://github.com/golang/go/issues/57007! (as of Go 1.21, the upstream release binaries are fully static and thus appropriate for Alpine)
10+
is_alpine and ([ "1.19", "1.20" ] | index(env.version | rtrimstr("-rc")))
711
-}}
812
{{ if is_alpine then ( -}}
913
FROM alpine:{{ alpine_version }}
@@ -77,11 +81,11 @@ RUN set -eux; \
7781
| (
7882
-}}
7983
{{ $osArch | @sh }}) \
80-
{{ if .url and (is_alpine | not) then ( -}}
84+
{{ if always_build_from_source or (.url | not) then ( -}}
85+
export {{ .env | to_entries | map(.key + "=" + (.value | @sh)) | join(" ") }}; \
86+
{{ ) else ( -}}
8187
url={{ .url | @sh }}; \
8288
sha256={{ .sha256 | @sh }}; \
83-
{{ ) else ( -}}
84-
export {{ .env | to_entries | map(.key + "=" + (.value | @sh)) | join(" ") }}; \
8589
{{ ) end -}}
8690
;; \
8791
{{
@@ -96,7 +100,7 @@ RUN set -eux; \
96100
build=1; \
97101
url={{ .arches.src.url | @sh }}; \
98102
sha256={{ .arches.src.sha256 | @sh }}; \
99-
{{ if is_alpine then ( -}}
103+
{{ if always_build_from_source then ( -}}
100104
# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅
101105
{{ ) else ( -}}
102106
echo >&2; \

0 commit comments

Comments
 (0)