fix: build talosctl without tcell_minimal
We do it for Talos itself to minimize the memory footprint and binary size for the `dashboard` when part of Talos, while for `talosctl` we want to have better support of various terminals. Fixes #9377 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com> (cherry picked from commit 4ab8dee69ac07c811cbe121ca9e2d9bd01148863)
This commit is contained in:
parent
d29f660799
commit
ffcdc0bb7a
32
Dockerfile
32
Dockerfile
@ -445,67 +445,67 @@ COPY --from=machined-build /machined /machined
|
||||
|
||||
FROM base AS talosctl-linux-amd64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
ARG GOAMD64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-amd64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-amd64
|
||||
RUN chmod +x /talosctl-linux-amd64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-linux-amd64
|
||||
|
||||
FROM base AS talosctl-linux-arm64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm64 go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-arm64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm64 go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-arm64
|
||||
RUN chmod +x /talosctl-linux-arm64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-linux-arm64
|
||||
|
||||
FROM base AS talosctl-linux-armv7-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm GOARM=7 go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-armv7
|
||||
RUN --mount=type=cache,target=/.cache GOOS=linux GOARCH=arm GOARM=7 go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-linux-armv7
|
||||
RUN chmod +x /talosctl-linux-armv7
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-linux-armv7
|
||||
|
||||
FROM base AS talosctl-darwin-amd64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
ARG GOAMD64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=darwin GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-darwin-amd64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=darwin GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-darwin-amd64
|
||||
RUN chmod +x /talosctl-darwin-amd64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-darwin-amd64
|
||||
|
||||
FROM base AS talosctl-darwin-arm64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
RUN --mount=type=cache,target=/.cache GOOS=darwin GOARCH=arm64 go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-darwin-arm64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=darwin GOARCH=arm64 go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-darwin-arm64
|
||||
RUN chmod +x /talosctl-darwin-arm64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" talosctl-darwin-arm64
|
||||
|
||||
FROM base AS talosctl-windows-amd64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
ARG GOAMD64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=windows GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-windows-amd64.exe
|
||||
RUN --mount=type=cache,target=/.cache GOOS=windows GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-windows-amd64.exe
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-windows-amd64.exe
|
||||
|
||||
FROM base AS talosctl-freebsd-amd64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
ARG GOAMD64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=freebsd GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-freebsd-amd64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=freebsd GOARCH=amd64 GOAMD64=${GOAMD64} go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-freebsd-amd64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-freebsd-amd64
|
||||
|
||||
FROM base AS talosctl-freebsd-arm64-build
|
||||
WORKDIR /src/cmd/talosctl
|
||||
ARG GO_BUILDFLAGS
|
||||
ARG GO_BUILDFLAGS_TALOSCTL
|
||||
ARG GO_LDFLAGS
|
||||
RUN --mount=type=cache,target=/.cache GOOS=freebsd GOARCH=arm64 go build ${GO_BUILDFLAGS} -ldflags "${GO_LDFLAGS}" -o /talosctl-freebsd-arm64
|
||||
RUN --mount=type=cache,target=/.cache GOOS=freebsd GOARCH=arm64 go build ${GO_BUILDFLAGS_TALOSCTL} -ldflags "${GO_LDFLAGS}" -o /talosctl-freebsd-arm64
|
||||
RUN touch --date="@${SOURCE_DATE_EPOCH}" /talosctl-freebsd-arm64
|
||||
|
||||
FROM scratch AS talosctl-linux-amd64
|
||||
|
4
Makefile
4
Makefile
@ -121,6 +121,7 @@ IMAGER_ARGS ?=
|
||||
CGO_ENABLED ?= 0
|
||||
GO_BUILDFLAGS ?=
|
||||
GO_BUILDTAGS ?= tcell_minimal,grpcnotrace
|
||||
GO_BUILDTAGS_TALOSCTL ?= grpcnotrace
|
||||
GO_LDFLAGS ?=
|
||||
GOAMD64 ?= v2
|
||||
|
||||
@ -136,10 +137,12 @@ endif
|
||||
|
||||
ifneq (, $(filter $(WITH_DEBUG), t true TRUE y yes 1))
|
||||
GO_BUILDTAGS := $(GO_BUILDTAGS),sidero.debug
|
||||
GO_BUILDTAGS_TALOSCTL := $(GO_BUILDTAGS_TALOSCTL),sidero.debug
|
||||
else
|
||||
GO_LDFLAGS += -s -w
|
||||
endif
|
||||
|
||||
GO_BUILDFLAGS_TALOSCTL := $(GO_BUILDFLAGS) -tags "$(GO_BUILDTAGS_TALOSCTL)"
|
||||
GO_BUILDFLAGS += -tags "$(GO_BUILDTAGS)"
|
||||
|
||||
, := ,
|
||||
@ -177,6 +180,7 @@ COMMON_ARGS += --build-arg=TESTPKGS=$(TESTPKGS)
|
||||
COMMON_ARGS += --build-arg=INSTALLER_ARCH=$(INSTALLER_ARCH)
|
||||
COMMON_ARGS += --build-arg=CGO_ENABLED=$(CGO_ENABLED)
|
||||
COMMON_ARGS += --build-arg=GO_BUILDFLAGS="$(GO_BUILDFLAGS)"
|
||||
COMMON_ARGS += --build-arg=GO_BUILDFLAGS_TALOSCTL="$(GO_BUILDFLAGS_TALOSCTL)"
|
||||
COMMON_ARGS += --build-arg=GO_LDFLAGS="$(GO_LDFLAGS)"
|
||||
COMMON_ARGS += --build-arg=GOAMD64="$(GOAMD64)"
|
||||
COMMON_ARGS += --build-arg=http_proxy=$(http_proxy)
|
||||
|
Loading…
Reference in New Issue
Block a user