talosctl

Source

FROM stagex/pallet-go AS build
ARG VERSION
ADD fetch/talosctl-${VERSION}.tar.gz .
WORKDIR /talos-${VERSION}
ENV GOPATH=/cache/go
ENV GOCACHE=/cache/
ENV GOWORK=off
ENV GOPROXY=https://proxy.golang.org,direct
ENV GOSUMDB=sum.golang.org
ENV CGO_ENABLED=0
ENV GOHOSTOS=linux
ENV GOHOSTARCH=amd64
RUN go get ./...
RUN <<-EOF
	go build -v -trimpath ./cmd/talosctl
	mkdir -p /rootfs/usr/bin/
	cp talosctl /rootfs/usr/bin/
	install -vDm644 -t /rootfs/usr/share/licenses/talosctl LICENSE
	# Completions subpackage
  for shell in bash fish zsh; do
    ./talosctl completion "$shell" > "$shell.completion"
  done
	install -vDm644 -t /rootfs-completions/usr/share/bash-completion/completions/talosctl bash.completion
	install -vDm644 -t /rootfs-completions/usr/share/fish/completions/talosctl.fish fish.completion
	install -vDm644 -t /rootfs-completions/usr/share/zsh/site-functions/_talosctl zsh.completion
EOF

FROM stagex/core-filesystem AS package-talosctl
COPY --from=build /rootfs/ /

FROM stagex/core-filesystem AS package-talosctl-completions
COPY --from=build /rootfs-completions/ /
Copied to clipboard!