35 lines
908 B
Docker
35 lines
908 B
Docker
FROM scratch AS base
|
|
ENV VERSION=1.7.2
|
|
ENV SRC_HASH=7f16510394ebe12cd405bc9d2cf4c6ef2c8baf6213006d52c05dcbce0bf06100
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
ENV SRC_SITE=https://github.com/siderolabs/talos/archive/refs/tags/${SRC_FILE}
|
|
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
|
|
ENV GO11MODULE=on
|
|
|
|
FROM base AS fetch
|
|
COPY --from=stagex/busybox . /
|
|
COPY --from=stagex/go . /
|
|
COPY --from=stagex/ca-certificates . /
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
|
RUN tar -xvf ${SRC_FILE}
|
|
WORKDIR talos-${VERSION}
|
|
RUN go get ./...
|
|
|
|
FROM fetch AS build
|
|
RUN --network=none go build -v -trimpath ./cmd/talosctl
|
|
|
|
from build as install
|
|
RUN <<-EOF
|
|
mkdir -p /rootfs/usr/bin/
|
|
cp talosctl /rootfs/usr/bin/
|
|
EOF
|
|
|
|
FROM stagex/filesystem AS package
|
|
COPY --from=install /rootfs/./ /
|