Skip to content

Commit

Permalink
Merge pull request #474 from infosiftr/alpine-1.21-upstream
Browse files Browse the repository at this point in the history
Use upstream binaries for Alpine in 1.21+
  • Loading branch information
yosifkit authored Jul 12, 2023
2 parents bba543a + 0ac27a1 commit 5eca4a0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
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

0 comments on commit 5eca4a0

Please sign in to comment.