From 59c3f62102b638910d19722ce2870c4236d38c66 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Fri, 3 Jan 2025 13:28:18 +0200 Subject: [PATCH] Update linuxkit/alpine Signed-off-by: Avi Deitcher --- tools/alpine/Dockerfile | 2 +- tools/alpine/Makefile | 15 ++++++++++++--- tools/alpine/go-compile.sh | 12 ++++++++++-- tools/alpine/packages.riscv64 | 0 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 tools/alpine/packages.riscv64 diff --git a/tools/alpine/Dockerfile b/tools/alpine/Dockerfile index 18e5ce9e1..09f0ce557 100644 --- a/tools/alpine/Dockerfile +++ b/tools/alpine/Dockerfile @@ -1,4 +1,4 @@ -ARG ALPINE_VERSION=3.19 +ARG ALPINE_VERSION=3.21 FROM alpine:${ALPINE_VERSION} AS mirror # update base image diff --git a/tools/alpine/Makefile b/tools/alpine/Makefile index df9fb650b..dd995ee23 100644 --- a/tools/alpine/Makefile +++ b/tools/alpine/Makefile @@ -5,15 +5,24 @@ IMAGE=alpine DEPS=packages ARCH := $(shell uname -m) +DARCH := $(ARCH) ifeq ($(ARCH), x86_64) DEPS += packages.x86_64 +DARCH = amd64 endif ifeq ($(ARCH), aarch64) DEPS += packages.aarch64 +DARCH = arm64 endif ifeq ($(ARCH), s390x) DEPS += packages.s390x endif +ifeq ($(ARCH), riscv64) +DEPS += packages.riscv64 +DARCH = riscv64 +endif + +PLATFORM := linux/$(DARCH) ORG?=linuxkit IMAGE?=alpine @@ -30,14 +39,14 @@ show-tag: @echo "$(ORG)/$(IMAGE):$(TAG)" iid: Dockerfile Makefile $(DEPS) - docker build --no-cache --iidfile iid . + docker build --platform $(PLATFORM) --no-cache --iidfile iid . hash: Makefile iid - docker run --rm $(shell cat iid) cat /etc/alpine-hash-arch > $@ + docker run --rm --platform $(PLATFORM) $(shell cat iid) cat /etc/alpine-hash-arch > $@ versions.$(ARCH): Makefile hash iid echo "# $(ORG)/$(IMAGE):$(shell cat hash)" > versions.$(ARCH) - docker run --rm $(shell cat iid) find /mirror -name '*.apk' -exec basename '{}' .apk \; | LANG=C sort | (echo '# automatically generated list of installed packages'; cat -) >> versions.$(ARCH) + docker run --rm --platform $(PLATFORM) $(shell cat iid) find /mirror -name '*.apk' -exec basename '{}' .apk \; | LANG=C sort | (echo '# automatically generated list of installed packages'; cat -) >> versions.$(ARCH) push: hash iid versions.$(ARCH) docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \ diff --git a/tools/alpine/go-compile.sh b/tools/alpine/go-compile.sh index 5c84e2e5a..3703d6c65 100755 --- a/tools/alpine/go-compile.sh +++ b/tools/alpine/go-compile.sh @@ -34,7 +34,15 @@ go test >&2 echo "go build..." -[ "${REQUIRE_CGO}" = 1 ] || export CGO_ENABLED=0 +export CGO_ENABLED=0 +linkmode="" +piemode="" -go install -buildmode pie -ldflags "-linkmode=external -s -w ${ldflags} -extldflags \"-fno-PIC -static\"" +if [ "${REQUIRE_CGO}" = 1 ]; then + export CGO_ENABLED=1 + linkmode="-linkmode=external" + piemode="-buildmode=pie" +fi + +go install ${piemode} -ldflags "${linkmode} -s -w ${ldflags} -extldflags \"-fno-PIC -static\"" diff --git a/tools/alpine/packages.riscv64 b/tools/alpine/packages.riscv64 new file mode 100644 index 000000000..e69de29bb