Skip to content

Use upstream binaries for Alpine in 1.21+ #474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions 1.21-rc/alpine3.17/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions 1.21-rc/alpine3.18/Dockerfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Dockerfile-linux.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
;
def alpine_version:
env.variant | ltrimstr("alpine")
;
def always_build_from_source:
# https://github.com/golang/go/issues/57007! (as of Go 1.21, the upstream release binaries are fully static and thus appropriate for Alpine)
is_alpine and ([ "1.19", "1.20" ] | index(env.version | rtrimstr("-rc")))
-}}
{{ if is_alpine then ( -}}
FROM alpine:{{ alpine_version }}
Expand Down Expand Up @@ -77,11 +81,11 @@ RUN set -eux; \
| (
-}}
{{ $osArch | @sh }}) \
{{ if .url and (is_alpine | not) then ( -}}
{{ if always_build_from_source or (.url | not) then ( -}}
export {{ .env | to_entries | map(.key + "=" + (.value | @sh)) | join(" ") }}; \
{{ ) else ( -}}
url={{ .url | @sh }}; \
sha256={{ .sha256 | @sh }}; \
{{ ) else ( -}}
export {{ .env | to_entries | map(.key + "=" + (.value | @sh)) | join(" ") }}; \
{{ ) end -}}
;; \
{{
Expand All @@ -96,7 +100,7 @@ RUN set -eux; \
build=1; \
url={{ .arches.src.url | @sh }}; \
sha256={{ .arches.src.sha256 | @sh }}; \
{{ if is_alpine then ( -}}
{{ if always_build_from_source then ( -}}
# the precompiled binaries published by Go upstream are not compatible with Alpine, so we always build from source here 😅
{{ ) else ( -}}
echo >&2; \
Expand Down