2020-09-26 00:00:43 +03:00
# syntax = docker/dockerfile-upstream:1.1.7-experimental
2019-07-06 09:20:24 +03:00
2019-08-07 01:08:27 +03:00
# Meta args applied to stage base names.
2019-07-13 03:24:51 +03:00
ARG TOOLS
2020-05-08 21:44:20 +03:00
ARG IMPORTVET
2020-09-07 16:52:26 +03:00
ARG PKGS
2020-10-30 01:08:05 +03:00
ARG EXTRAS
2020-09-07 16:52:26 +03:00
# Resolve package images using ${PKGS} to be used later in COPY --from=.
2020-09-24 00:08:47 +03:00
FROM ghcr.io/talos-systems/fhs:${PKGS} AS pkg-fhs
FROM ghcr.io/talos-systems/ca-certificates:${PKGS} AS pkg-ca-certificates
FROM ghcr.io/talos-systems/containerd:${PKGS} AS pkg-containerd
FROM ghcr.io/talos-systems/dosfstools:${PKGS} AS pkg-dosfstools
FROM ghcr.io/talos-systems/eudev:${PKGS} AS pkg-eudev
FROM ghcr.io/talos-systems/grub:${PKGS} AS pkg-grub
FROM ghcr.io/talos-systems/iptables:${PKGS} AS pkg-iptables
FROM ghcr.io/talos-systems/libressl:${PKGS} AS pkg-libressl
FROM ghcr.io/talos-systems/libseccomp:${PKGS} AS pkg-libseccomp
FROM ghcr.io/talos-systems/linux-firmware:${PKGS} AS pkg-linux-firmware
FROM ghcr.io/talos-systems/lvm2:${PKGS} AS pkg-lvm2
FROM ghcr.io/talos-systems/libaio:${PKGS} AS pkg-libaio
FROM ghcr.io/talos-systems/musl:${PKGS} AS pkg-musl
FROM ghcr.io/talos-systems/open-iscsi:${PKGS} AS pkg-open-iscsi
FROM ghcr.io/talos-systems/open-isns:${PKGS} AS pkg-open-isns
FROM ghcr.io/talos-systems/runc:${PKGS} AS pkg-runc
FROM ghcr.io/talos-systems/xfsprogs:${PKGS} AS pkg-xfsprogs
FROM ghcr.io/talos-systems/util-linux:${PKGS} AS pkg-util-linux
FROM ghcr.io/talos-systems/kmod:${PKGS} AS pkg-kmod
FROM ghcr.io/talos-systems/kernel:${PKGS} AS pkg-kernel
2019-08-07 01:08:27 +03:00
2020-10-30 01:08:05 +03:00
# Resolve package images using ${EXTRAS} to be used later in COPY --from=.
FROM ghcr.io/talos-systems/talosctl-cni-bundle-install:${EXTRAS} AS extras-talosctl-cni-bundle-install
2019-08-07 01:08:27 +03:00
# The tools target provides base toolchain for the build.
2020-05-08 21:44:20 +03:00
FROM $IMPORTVET as importvet
2019-07-13 03:24:51 +03:00
FROM $TOOLS AS tools
2019-09-10 21:12:28 +03:00
ENV PATH /toolchain/bin:/toolchain/go/bin
2019-07-13 03:24:51 +03:00
RUN [ "/toolchain/bin/mkdir" , "/bin" , "/tmp" ]
RUN [ "/toolchain/bin/ln" , "-svf" , "/toolchain/bin/bash" , "/bin/sh" ]
RUN [ "/toolchain/bin/ln" , "-svf" , "/toolchain/etc/ssl" , "/etc/ssl" ]
2020-11-03 07:05:15 +03:00
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.32.2
2020-07-16 16:25:04 +03:00
ARG GOFUMPT_VERSION
2019-09-10 21:12:28 +03:00
RUN cd $( mktemp -d) \
&& go mod init tmp \
2020-07-16 16:25:04 +03:00
&& go get mvdan.cc/gofumpt/gofumports@${ GOFUMPT_VERSION } \
2019-09-12 17:32:42 +03:00
&& mv /go/bin/gofumports /toolchain/go/bin/gofumports
2019-08-28 00:45:59 +03:00
RUN curl -sfL https://github.com/uber/prototool/releases/download/v1.8.0/prototool-Linux-x86_64.tar.gz | tar -xz --strip-components= 2 -C /toolchain/bin prototool/bin/prototool
2019-11-09 18:22:43 +03:00
COPY ./hack/docgen /go/src/github.com/talos-systems/docgen
RUN cd /go/src/github.com/talos-systems/docgen \
&& go build . \
&& mv docgen /toolchain/go/bin/
2020-05-08 21:44:20 +03:00
COPY --from= importvet /importvet /toolchain/go/bin/importvet
2019-07-13 03:24:51 +03:00
# The build target creates a container that will be used to build Talos source
# code.
FROM scratch AS build
COPY --from= tools / /
SHELL [ "/toolchain/bin/bash" , "-c" ]
ENV PATH /toolchain/bin:/toolchain/go/bin
ENV GO111MODULE on
ENV GOPROXY https://proxy.golang.org
ENV CGO_ENABLED 0
WORKDIR /src
2018-12-20 09:22:05 +03:00
2019-07-13 03:24:51 +03:00
# The generate target generates code from protobuf service definitions.
2019-01-18 17:26:12 +03:00
2019-07-13 03:24:51 +03:00
FROM build AS generate-build
2019-10-24 05:31:18 +03:00
# Common needs to be at or near the top to satisfy the subsequent imports
2019-10-21 21:21:46 +03:00
COPY ./api/common/common.proto /api/common/common.proto
2019-12-30 00:33:05 +03:00
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api common/common.proto
2020-01-23 01:14:58 +03:00
COPY ./api/health/health.proto /api/health/health.proto
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api health/health.proto
2019-10-21 21:21:46 +03:00
COPY ./api/security/security.proto /api/security/security.proto
2019-12-30 00:33:05 +03:00
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api security/security.proto
2019-10-21 21:21:46 +03:00
COPY ./api/machine/machine.proto /api/machine/machine.proto
2019-12-30 00:33:05 +03:00
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api machine/machine.proto
2019-10-21 21:21:46 +03:00
COPY ./api/time/time.proto /api/time/time.proto
2019-12-30 00:33:05 +03:00
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api time/time.proto
2019-10-21 21:21:46 +03:00
COPY ./api/network/network.proto /api/network/network.proto
2019-12-30 00:33:05 +03:00
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api network/network.proto
2020-07-13 20:56:47 +03:00
COPY ./api/os/os.proto /api/os/os.proto
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api os/os.proto
2020-07-13 23:48:41 +03:00
COPY ./api/cluster/cluster.proto /api/cluster/cluster.proto
RUN protoc -I/api --go_out= plugins = grpc,paths= source_relative:/api cluster/cluster.proto
2019-11-09 00:08:38 +03:00
# Gofumports generated files to adjust import order
RUN gofumports -w -local github.com/talos-systems/talos /api/
2019-07-21 21:27:15 +03:00
2020-10-20 22:05:13 +03:00
# run docgen for machinery config
COPY ./pkg/machinery /pkg/machinery
WORKDIR /pkg/machinery
RUN go generate /pkg/machinery/config/types/v1alpha1/
WORKDIR /
2019-07-13 03:24:51 +03:00
FROM scratch AS generate
2020-08-17 19:12:47 +03:00
COPY --from= generate-build /api/common/common.pb.go /pkg/machinery/api/common/
COPY --from= generate-build /api/health/health.pb.go /pkg/machinery/api/health/
COPY --from= generate-build /api/os/os.pb.go /pkg/machinery/api/os/
COPY --from= generate-build /api/security/security.pb.go /pkg/machinery/api/security/
COPY --from= generate-build /api/machine/machine.pb.go /pkg/machinery/api/machine/
COPY --from= generate-build /api/time/time.pb.go /pkg/machinery/api/time/
COPY --from= generate-build /api/network/network.pb.go /pkg/machinery/api/network/
COPY --from= generate-build /api/cluster/cluster.pb.go /pkg/machinery/api/cluster/
2020-10-20 22:05:13 +03:00
COPY --from= generate-build /pkg/machinery/config/types/v1alpha1/*_doc.go /pkg/machinery/config/types/v1alpha1/
2019-03-28 02:33:03 +03:00
2019-07-13 03:24:51 +03:00
# The base target provides a container that can be used to build all Talos
# assets.
2019-01-18 17:26:12 +03:00
2019-07-13 03:24:51 +03:00
FROM build AS base
2020-08-17 19:12:47 +03:00
COPY ./go.mod ./go.sum ./
COPY ./pkg/machinery/go.mod ./pkg/machinery/go.sum ./pkg/machinery/
2018-12-20 09:22:05 +03:00
RUN go mod download
RUN go mod verify
2019-04-11 02:50:56 +03:00
COPY ./cmd ./cmd
COPY ./pkg ./pkg
COPY ./internal ./internal
2020-08-17 19:12:47 +03:00
COPY --from= generate /pkg/machinery/api ./pkg/machinery/api
2020-10-20 22:05:13 +03:00
COPY --from= generate /pkg/machinery/config ./pkg/machinery/config
2019-04-17 23:25:22 +03:00
RUN go list -mod= readonly all >/dev/null
2019-06-22 07:18:08 +03:00
RUN ! go mod tidy -v 2>& 1 | grep .
2018-12-20 09:22:05 +03:00
2019-07-13 03:24:51 +03:00
# The init target builds the init binary.
FROM base AS init-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2019-07-13 03:24:51 +03:00
WORKDIR /src/internal/app/init
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Talos -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /init
2019-07-13 03:24:51 +03:00
RUN chmod +x /init
2019-07-21 21:27:15 +03:00
2019-07-13 03:24:51 +03:00
FROM scratch AS init
COPY --from= init-build /init /init
2019-07-16 18:09:35 +03:00
# The machined target builds the machined image.
FROM base AS machined-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-09-19 06:34:59 +03:00
ARG USERNAME
ARG REGISTRY
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2019-07-16 18:09:35 +03:00
WORKDIR /src/internal/app/machined
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Talos -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } " -o /machined
2019-07-16 18:09:35 +03:00
RUN chmod +x /machined
2019-07-21 21:27:15 +03:00
2019-07-16 18:09:35 +03:00
FROM scratch AS machined
COPY --from= machined-build /machined /machined
2020-04-11 22:43:09 +03:00
# The timed target builds the timed image.
2019-07-13 03:24:51 +03:00
2020-04-11 22:43:09 +03:00
FROM base AS timed-build
2019-07-13 03:24:51 +03:00
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-04-11 22:43:09 +03:00
WORKDIR /src/internal/app/timed
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /timed
2020-04-11 22:43:09 +03:00
RUN chmod +x /timed
2019-07-21 21:27:15 +03:00
2020-04-11 22:43:09 +03:00
FROM base AS timed-image
2020-02-14 15:26:44 +03:00
ARG TAG
ARG USERNAME
2020-04-11 22:43:09 +03:00
COPY --from= timed-build /timed /scratch/timed
2020-02-14 15:26:44 +03:00
WORKDIR /scratch
2020-04-11 22:43:09 +03:00
RUN printf "FROM scratch\nCOPY ./timed /timed\nENTRYPOINT [\"/timed\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /timed:${ TAG } --output type = docker,dest= /timed.tar --no-console .
2019-07-13 03:24:51 +03:00
2019-10-24 05:31:18 +03:00
# The apid target builds the api image.
FROM base AS apid-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-10-24 05:31:18 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
WORKDIR /src/internal/app/apid
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /apid
2019-10-24 05:31:18 +03:00
RUN chmod +x /apid
2020-02-14 15:26:44 +03:00
FROM base AS apid-image
ARG TAG
ARG USERNAME
COPY --from= apid-build /apid /scratch/apid
WORKDIR /scratch
RUN printf "FROM scratch\nCOPY ./apid /apid\nENTRYPOINT [\"/apid\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /apid:${ TAG } --output type = docker,dest= /apid.tar --no-console .
2019-10-24 05:31:18 +03:00
2019-04-19 05:31:43 +03:00
# The trustd target builds the trustd image.
2019-01-18 17:26:12 +03:00
2019-04-19 05:31:43 +03:00
FROM base AS trustd-build
2018-12-20 09:22:05 +03:00
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2018-12-20 09:22:05 +03:00
WORKDIR /src/internal/app/trustd
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /trustd
2018-12-20 09:22:05 +03:00
RUN chmod +x /trustd
2019-07-21 21:27:15 +03:00
2020-02-14 15:26:44 +03:00
FROM base AS trustd-image
ARG TAG
ARG USERNAME
COPY --from= trustd-build /trustd /scratch/trustd
WORKDIR /scratch
RUN printf "FROM scratch\nCOPY ./trustd /trustd\nENTRYPOINT [\"/trustd\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /trustd:${ TAG } --output type = docker,dest= /trustd.tar --no-console .
2018-12-20 09:22:05 +03:00
2019-08-03 00:08:24 +03:00
# The networkd target builds the networkd image.
FROM base AS networkd-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-09-28 21:37:57 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2019-08-03 00:08:24 +03:00
WORKDIR /src/internal/app/networkd
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /networkd
2019-08-03 00:08:24 +03:00
RUN chmod +x /networkd
2020-02-14 15:26:44 +03:00
FROM base AS networkd-image
ARG TAG
ARG USERNAME
COPY --from= networkd-build /networkd /scratch/networkd
WORKDIR /scratch
RUN printf "FROM scratch\nCOPY ./networkd /networkd\nENTRYPOINT [\"/networkd\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /networkd:${ TAG } --output type = docker,dest= /networkd.tar --no-console .
2020-03-04 22:25:27 +03:00
# The routerd target builds the routerd image.
FROM base AS routerd-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-09-28 21:37:57 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-03-04 22:25:27 +03:00
WORKDIR /src/internal/app/routerd
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /routerd
2020-03-04 22:25:27 +03:00
RUN chmod +x /routerd
FROM base AS routerd-image
ARG TAG
ARG USERNAME
COPY --from= routerd-build /routerd /scratch/routerd
WORKDIR /scratch
RUN printf "FROM scratch\nCOPY ./routerd /routerd\nENTRYPOINT [\"/routerd\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /routerd:${ TAG } --output type = docker,dest= /routerd.tar --no-console .
2019-08-03 00:08:24 +03:00
2020-03-27 21:46:38 +03:00
# The bootkube target builds the bootkube image.
FROM base AS bootkube-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-09-28 21:37:57 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-03-27 21:46:38 +03:00
WORKDIR /src/internal/app/bootkube
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Server -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } " -o /bootkube
2020-03-27 21:46:38 +03:00
RUN chmod +x /bootkube
FROM base AS bootkube-image
ARG TAG
ARG USERNAME
COPY --from= bootkube-build /bootkube /scratch/bootkube
WORKDIR /scratch
RUN printf "FROM scratch\nCOPY ./bootkube /bootkube\nENTRYPOINT [\"/bootkube\"]" > Dockerfile
RUN --security= insecure img build --tag ${ USERNAME } /bootkube:${ TAG } --output type = docker,dest= /bootkube.tar --no-console .
2020-03-21 03:38:48 +03:00
# The talosctl targets build the talosctl binaries.
2019-01-18 17:26:12 +03:00
2020-03-22 00:27:03 +03:00
FROM base AS talosctl-linux-amd64-build
2018-12-20 09:22:05 +03:00
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-12-27 23:49:24 +03:00
ARG ARTIFACTS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-03-21 03:38:48 +03:00
ARG MGMT_HELPERS_PKG = "github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
WORKDIR /src/cmd/talosctl
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = amd64 go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } -X ${ MGMT_HELPERS_PKG } .ArtifactsPath= ${ ARTIFACTS } " -o /talosctl-linux-amd64
2020-03-21 03:38:48 +03:00
RUN chmod +x /talosctl-linux-amd64
2019-07-21 21:27:15 +03:00
2020-03-22 00:27:03 +03:00
FROM base AS talosctl-linux-arm64-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-03-22 00:27:03 +03:00
ARG ARTIFACTS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2020-03-22 00:27:03 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-03-22 00:27:03 +03:00
ARG MGMT_HELPERS_PKG = "github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
WORKDIR /src/cmd/talosctl
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = arm64 go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } -X ${ MGMT_HELPERS_PKG } .ArtifactsPath= ${ ARTIFACTS } " -o /talosctl-linux-arm64
2020-03-22 00:27:03 +03:00
RUN chmod +x /talosctl-linux-arm64
2020-03-22 04:08:09 +03:00
FROM base AS talosctl-linux-armv7-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-03-22 04:08:09 +03:00
ARG ARTIFACTS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2020-03-22 04:08:09 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-03-22 04:08:09 +03:00
ARG MGMT_HELPERS_PKG = "github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
WORKDIR /src/cmd/talosctl
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = arm GOARM = 7 go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } -X ${ MGMT_HELPERS_PKG } .ArtifactsPath= ${ ARTIFACTS } " -o /talosctl-linux-armv7
2020-03-22 04:08:09 +03:00
RUN chmod +x /talosctl-linux-armv7
2020-03-21 03:38:48 +03:00
FROM scratch AS talosctl-linux
2020-03-22 00:27:03 +03:00
COPY --from= talosctl-linux-amd64-build /talosctl-linux-amd64 /talosctl-linux-amd64
COPY --from= talosctl-linux-arm64-build /talosctl-linux-arm64 /talosctl-linux-arm64
2020-03-22 04:08:09 +03:00
COPY --from= talosctl-linux-armv7-build /talosctl-linux-armv7 /talosctl-linux-armv7
2019-04-19 05:31:43 +03:00
2020-03-21 03:38:48 +03:00
FROM base AS talosctl-darwin-build
2019-04-19 05:31:43 +03:00
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2019-12-27 23:49:24 +03:00
ARG ARTIFACTS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-03-21 03:38:48 +03:00
ARG MGMT_HELPERS_PKG = "github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
WORKDIR /src/cmd/talosctl
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = darwin GOARCH = amd64 go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } -X ${ MGMT_HELPERS_PKG } .ArtifactsPath= ${ ARTIFACTS } " -o /talosctl-darwin-amd64
2020-03-21 03:38:48 +03:00
RUN chmod +x /talosctl-darwin-amd64
2019-07-21 21:27:15 +03:00
2020-03-21 03:38:48 +03:00
FROM scratch AS talosctl-darwin
COPY --from= talosctl-darwin-build /talosctl-darwin-amd64 /talosctl-darwin-amd64
2019-04-19 05:31:43 +03:00
# The kernel target is the linux kernel.
2019-07-13 03:24:51 +03:00
FROM scratch AS kernel
2020-09-26 00:00:43 +03:00
ARG TARGETARCH
COPY --from= pkg-kernel /boot/vmlinuz /vmlinuz-${ TARGETARCH }
2019-04-19 05:31:43 +03:00
2019-07-21 21:27:15 +03:00
# The rootfs target provides the Talos rootfs.
2019-04-19 05:31:43 +03:00
2019-07-21 21:27:15 +03:00
FROM build AS rootfs-base
2020-09-07 16:52:26 +03:00
COPY --from= pkg-fhs / /rootfs
COPY --from= pkg-ca-certificates / /rootfs
COPY --from= pkg-containerd / /rootfs
COPY --from= pkg-dosfstools / /rootfs
COPY --from= pkg-eudev / /rootfs
COPY --from= pkg-iptables / /rootfs
COPY --from= pkg-libressl / /rootfs
COPY --from= pkg-libseccomp / /rootfs
COPY --from= pkg-linux-firmware /lib/firmware/bnx2 /rootfs/lib/firmware/bnx2
COPY --from= pkg-linux-firmware /lib/firmware/bnx2x /rootfs/lib/firmware/bnx2x
COPY --from= pkg-lvm2 / /rootfs
COPY --from= pkg-libaio / /rootfs
COPY --from= pkg-musl / /rootfs
COPY --from= pkg-open-iscsi / /rootfs
COPY --from= pkg-open-isns / /rootfs
COPY --from= pkg-runc / /rootfs
COPY --from= pkg-xfsprogs / /rootfs
COPY --from= pkg-util-linux /lib/libblkid.* /rootfs/lib/
COPY --from= pkg-util-linux /lib/libuuid.* /rootfs/lib/
COPY --from= pkg-util-linux /lib/libmount.* /rootfs/lib/
COPY --from= pkg-kmod /usr/lib/libkmod.* /rootfs/lib/
COPY --from= pkg-kernel /lib/modules /rootfs/lib/modules
2019-07-21 21:27:15 +03:00
COPY --from= machined /machined /rootfs/sbin/init
2020-02-14 15:26:44 +03:00
COPY --from= apid-image /apid.tar /rootfs/usr/images/
2020-03-27 21:46:38 +03:00
COPY --from= bootkube-image /bootkube.tar /rootfs/usr/images/
2020-04-11 22:43:09 +03:00
COPY --from= timed-image /timed.tar /rootfs/usr/images/
2020-02-14 15:26:44 +03:00
COPY --from= trustd-image /trustd.tar /rootfs/usr/images/
COPY --from= networkd-image /networkd.tar /rootfs/usr/images/
2020-03-04 22:25:27 +03:00
COPY --from= routerd-image /routerd.tar /rootfs/usr/images/
2019-07-26 00:38:20 +03:00
# NB: We run the cleanup step before creating extra directories, files, and
# symlinks to avoid accidentally cleaning them up.
COPY ./hack/cleanup.sh /toolchain/bin/cleanup.sh
RUN cleanup.sh /rootfs
2019-12-05 02:20:17 +03:00
COPY hack/containerd.toml /rootfs/etc/cri/containerd.toml
2019-07-21 21:27:15 +03:00
RUN touch /rootfs/etc/resolv.conf
RUN touch /rootfs/etc/hosts
RUN touch /rootfs/etc/os-release
2020-07-01 06:48:46 +03:00
RUN mkdir -pv /rootfs/{ boot,usr/local/share,mnt,system}
2019-07-21 21:27:15 +03:00
RUN mkdir -pv /rootfs/{ etc/kubernetes/manifests,etc/cni,usr/libexec/kubernetes}
RUN ln -s /etc/ssl /rootfs/etc/pki
RUN ln -s /etc/ssl /rootfs/usr/share/ca-certificates
RUN ln -s /etc/ssl /rootfs/usr/local/share/ca-certificates
RUN ln -s /etc/ssl /rootfs/etc/ca-certificates
2019-07-13 03:24:51 +03:00
2019-07-21 21:27:15 +03:00
FROM rootfs-base AS rootfs-squashfs
2019-07-27 11:09:50 +03:00
RUN mksquashfs /rootfs /rootfs.sqsh -all-root -noappend -comp xz -Xdict-size 100% -no-progress
2019-04-19 05:31:43 +03:00
2019-10-31 01:52:36 +03:00
FROM scratch AS squashfs
COPY --from= rootfs-squashfs /rootfs.sqsh /
2019-04-19 05:31:43 +03:00
FROM scratch AS rootfs
2019-07-21 21:27:15 +03:00
COPY --from= rootfs-base /rootfs /
# The initramfs target provides the Talos initramfs image.
FROM build AS initramfs-archive
WORKDIR /initramfs
2019-10-31 01:52:36 +03:00
COPY --from= squashfs /rootfs.sqsh .
2019-07-21 21:27:15 +03:00
COPY --from= init /init .
RUN set -o pipefail && find . 2>/dev/null | cpio -H newc -o | xz -v -C crc32 -0 -e -T 0 -z >/initramfs.xz
FROM scratch AS initramfs
2020-09-26 00:00:43 +03:00
ARG TARGETARCH
COPY --from= initramfs-archive /initramfs.xz /initramfs-${ TARGETARCH } .xz
2019-04-19 05:31:43 +03:00
2019-12-24 23:23:52 +03:00
# The talos target generates a docker image that can be used to run Talos
2019-04-19 05:31:43 +03:00
# in containers.
2019-12-24 23:23:52 +03:00
FROM scratch AS talos
2019-07-21 21:27:15 +03:00
COPY --from= rootfs / /
2020-10-19 22:52:21 +03:00
LABEL org.opencontainers.image.source https://github.com/talos-systems/talos
2019-07-21 21:27:15 +03:00
ENTRYPOINT [ "/sbin/init" ]
2019-04-19 05:31:43 +03:00
2019-05-16 02:14:30 +03:00
# The installer target generates an image that can be used to install Talos to
# various environments.
2019-04-19 05:31:43 +03:00
2019-11-01 07:55:58 +03:00
FROM base AS installer-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-09-19 06:34:59 +03:00
ARG USERNAME
ARG REGISTRY
2019-11-01 07:55:58 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2019-11-01 07:55:58 +03:00
WORKDIR /src/cmd/installer
2020-10-08 22:46:55 +03:00
RUN --mount= type = cache,target= /.cache/go-build go build -ldflags " -s -w -X ${ VERSION_PKG } .Name=Talos -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } " -o /installer
2019-11-01 07:55:58 +03:00
RUN chmod +x /installer
2020-11-01 00:03:56 +03:00
FROM alpine:3.11 AS unicode-pf2
RUN apk add --no-cache --update grub
2020-08-19 01:52:26 +03:00
FROM alpine:3.11 AS installer
2019-10-31 01:52:36 +03:00
RUN apk add --no-cache --update \
2019-06-26 05:25:57 +03:00
bash \
2019-09-23 13:42:35 +03:00
ca-certificates \
2020-08-19 01:52:26 +03:00
efibootmgr \
2020-11-01 00:03:56 +03:00
mtools \
2019-06-26 05:25:57 +03:00
qemu-img \
util-linux \
2020-11-01 00:03:56 +03:00
xfsprogs \
xorriso \
xz
2020-09-07 16:52:26 +03:00
COPY --from= pkg-grub / /
2020-11-01 00:03:56 +03:00
COPY --from= unicode-pf2 /usr/share/grub/unicode.pf2 /usr/share/grub/unicode.pf2
2020-09-26 00:00:43 +03:00
ARG TARGETARCH
COPY --from= kernel /vmlinuz-${ TARGETARCH } /usr/install/vmlinuz
COPY --from= initramfs /initramfs-${ TARGETARCH } .xz /usr/install/initramfs.xz
2019-11-01 07:55:58 +03:00
COPY --from= installer-build /installer /bin/installer
2020-03-21 03:38:48 +03:00
RUN ln -s /bin/installer /bin/talosctl
2019-04-19 05:31:43 +03:00
ARG TAG
ENV VERSION ${ TAG }
2019-12-30 06:43:40 +03:00
LABEL "alpha.talos.dev/version" = " ${ VERSION } "
2020-10-19 22:52:21 +03:00
LABEL org.opencontainers.image.source https://github.com/talos-systems/talos
2019-11-01 07:55:58 +03:00
ENTRYPOINT [ "/bin/installer" ]
2019-11-04 09:28:10 +03:00
ONBUILD RUN apk add --no-cache --update \
cpio \
squashfs-tools \
xz
2019-10-31 01:52:36 +03:00
ONBUILD WORKDIR /initramfs
ONBUILD ARG RM
ONBUILD RUN xz -d /usr/install/initramfs.xz \
&& cpio -idvm < /usr/install/initramfs \
&& unsquashfs -f -d /rootfs rootfs.sqsh \
&& for f in ${ RM } ; do rm -rfv /rootfs$f ; done \
&& rm /usr/install/initramfs \
&& rm rootfs.sqsh
ONBUILD COPY --from= customization / /rootfs
ONBUILD RUN find /rootfs \
&& mksquashfs /rootfs rootfs.sqsh -all-root -noappend -comp xz -Xdict-size 100% -no-progress \
&& set -o pipefail && find . 2>/dev/null | cpio -H newc -o | xz -v -C crc32 -0 -e -T 0 -z >/usr/install/initramfs.xz \
&& rm -rf /rootfs \
&& rm -rf /initramfs
ONBUILD WORKDIR /
2019-07-13 03:24:51 +03:00
# The test target performs tests on the source code.
2019-08-09 06:45:13 +03:00
FROM base AS unit-tests-runner
2019-07-13 03:24:51 +03:00
RUN unlink /etc/ssl
2019-07-21 21:27:15 +03:00
COPY --from= rootfs / /
2019-07-13 03:24:51 +03:00
COPY hack/golang/test.sh /bin
2019-07-23 17:17:16 +03:00
ARG TESTPKGS
2019-07-26 20:21:45 +03:00
RUN --security= insecure --mount= type = cache,id= testspace,target= /tmp --mount= type = cache,target= /.cache/go-build /bin/test.sh ${ TESTPKGS }
2019-08-09 06:45:13 +03:00
FROM scratch AS unit-tests
COPY --from= unit-tests-runner /src/coverage.txt /coverage.txt
2019-07-13 03:24:51 +03:00
2019-08-09 06:45:13 +03:00
# The unit-tests-race target performs tests with race detector.
2019-08-07 01:08:27 +03:00
2020-05-22 23:26:56 +03:00
FROM base AS unit-tests-race
RUN unlink /etc/ssl
COPY --from= rootfs / /
COPY hack/golang/test.sh /bin
2019-08-07 01:08:27 +03:00
ARG TESTPKGS
2020-05-22 23:26:56 +03:00
RUN --security= insecure --mount= type = cache,id= testspace,target= /tmp --mount= type = cache,target= /.cache/go-build /bin/test.sh --race ${ TESTPKGS }
2019-08-07 01:08:27 +03:00
2019-10-25 22:57:52 +03:00
# The integration-test target builds integration test binary.
2020-01-05 00:19:34 +03:00
FROM base AS integration-test-linux-build
2019-10-25 22:57:52 +03:00
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2019-10-25 22:57:52 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2019-10-25 22:57:52 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = amd64 go test -c \
2020-10-08 22:46:55 +03:00
-ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } " \
2019-11-06 14:32:07 +03:00
-tags integration,integration_api,integration_cli,integration_k8s \
2019-10-25 22:57:52 +03:00
./internal/integration
2020-01-05 00:19:34 +03:00
FROM scratch AS integration-test-linux
COPY --from= integration-test-linux-build /src/integration.test /integration-test-linux-amd64
FROM base AS integration-test-darwin-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
2020-01-05 00:19:34 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-01-05 00:19:34 +03:00
RUN --mount= type = cache,target= /.cache/go-build GOOS = darwin GOARCH = amd64 go test -c \
2020-10-08 22:46:55 +03:00
-ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } " \
2020-01-05 00:19:34 +03:00
-tags integration,integration_api,integration_cli,integration_k8s \
./internal/integration
FROM scratch AS integration-test-darwin
COPY --from= integration-test-darwin-build /src/integration.test /integration-test-darwin-amd64
2019-10-25 22:57:52 +03:00
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
# The integration-test-provision target builds integration test binary with provisioning tests.
FROM base AS integration-test-provision-linux-build
ARG SHA
ARG TAG
2020-09-28 21:37:57 +03:00
ARG PKGS
2020-10-08 22:46:55 +03:00
ARG EXTRAS
2020-08-19 01:52:26 +03:00
ARG USERNAME
ARG REGISTRY
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2020-09-25 00:24:33 +03:00
ARG IMAGES_PKGS = "github.com/talos-systems/talos/pkg/images"
2020-03-21 03:38:48 +03:00
ARG MGMT_HELPERS_PKG = "github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
ARG ARTIFACTS
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = amd64 go test -c \
2020-10-08 22:46:55 +03:00
-ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } -X ${ VERSION_PKG } .PkgsVersion= ${ PKGS } -X ${ VERSION_PKG } .ExtrasVersion= ${ EXTRAS } -X ${ IMAGES_PKGS } .Username= ${ USERNAME } -X ${ IMAGES_PKGS } .Registry= ${ REGISTRY } -X ${ MGMT_HELPERS_PKG } .ArtifactsPath= ${ ARTIFACTS } " \
test: implement new class of tests: provision tests (upgrades)
This class of tests is included/excluded by build tags, but as it is
pretty different from other integration tests, we build it as separate
executable. Provision tests provision cluster for the test run, perform
some actions and verify results (could be upgrade, reset, scale up/down,
etc.)
There's now framework to implement upgrade tests, first of the tests
tests upgrade from latest 0.3 (0.3.2 at the moment) to current version
of Talos (being built in CI). Tests starts by booting with 0.3
kernel/initramfs, runs 0.3 installer to install 0.3.2 cluster, wait for
bootstrap, followed by upgrade to 0.4 in rolling fashion. As Firecracker
supports bootloader, this boots 0.4 system from boot disk (as installed
by installer).
Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
2020-02-18 01:00:51 +03:00
-tags integration,integration_provision \
./internal/integration
FROM scratch AS integration-test-provision-linux
COPY --from= integration-test-provision-linux-build /src/integration.test /integration-test-provision-linux-amd64
2019-07-13 03:24:51 +03:00
# The lint target performs linting on the source code.
2019-12-24 20:28:58 +03:00
FROM base AS lint-go
2020-02-18 03:45:30 +03:00
COPY .golangci.yml .
2019-09-12 00:58:51 +03:00
ENV GOGC = 50
2020-05-08 21:44:20 +03:00
RUN --mount= type = cache,target= /.cache/go-build --mount= type = cache,target= /.cache/golangci-lint golangci-lint run --config .golangci.yml
2020-08-17 19:12:47 +03:00
WORKDIR /src/pkg/machinery
RUN --mount= type = cache,target= /.cache/go-build --mount= type = cache,target= /.cache/golangci-lint golangci-lint run --config ../../.golangci.yml
WORKDIR /src
2020-11-03 01:54:58 +03:00
# RUN --mount=type=cache,target=/.cache/go-build importvet github.com/talos-systems/talos/...
2019-09-10 21:12:28 +03:00
RUN find . -name '*.pb.go' | xargs rm
2019-09-12 17:32:42 +03:00
RUN FILES = " $( gofumports -l -local github.com/talos-systems/talos .) " && test -z " ${ FILES } " || ( echo -e " Source code is not formatted with 'gofumports -w -local github.com/talos-systems/talos .':\n ${ FILES } " ; exit 1)
2019-08-17 11:51:40 +03:00
2020-04-29 07:10:19 +03:00
# The protolint target performs linting on protobuf files.
2019-08-28 00:45:59 +03:00
2019-12-24 20:28:58 +03:00
FROM base AS lint-protobuf
2020-04-29 07:10:19 +03:00
WORKDIR /src/api
COPY api .
COPY prototool.yaml .
RUN prototool lint --protoc-bin-path= /toolchain/bin/protoc --protoc-wkt-path= /toolchain/include
2019-08-28 00:45:59 +03:00
2019-08-17 11:51:40 +03:00
# The markdownlint target performs linting on Markdown files.
2020-07-23 21:21:42 +03:00
FROM node:14.5.0-alpine AS lint-markdown
2020-11-04 08:52:06 +03:00
RUN apk add --no-cache findutils
2020-07-23 21:21:42 +03:00
RUN npm i -g markdownlint-cli@0.23.2
RUN npm i -g textlint@11.7.6
2020-05-06 18:40:07 +03:00
RUN npm i -g textlint-rule-one-sentence-per-line@1.0.2
2019-08-17 11:51:40 +03:00
WORKDIR /src
2020-04-27 06:07:08 +03:00
COPY . .
2020-11-04 08:52:06 +03:00
RUN markdownlint \
--ignore '**/LICENCE.md' \
--ignore '**/CHANGELOG.md' \
--ignore '**/CODE_OF_CONDUCT.md' \
--ignore '**/node_modules/**' \
--ignore '**/hack/chglog/**' \
--ignore 'website/content/docs/*/Reference/*'
RUN find . \
-name '*.md' \
-not -path './LICENCE.md' \
-not -path './CHANGELOG.md' \
-not -path './CODE_OF_CONDUCT.md' \
-not -path '*/node_modules/*' \
-not -path './hack/chglog/**' \
-not -path './website/content/docs/*/Reference/*' \
| xargs textlint --rule one-sentence-per-line --stdin-filename
2019-12-24 23:23:52 +03:00
# The docs target generates documentation.
FROM base AS docs-build
2020-08-17 19:12:47 +03:00
WORKDIR /src
2020-03-21 03:38:48 +03:00
COPY --from= talosctl-linux /talosctl-linux-amd64 /bin/talosctl
2020-10-23 05:39:37 +03:00
RUN env HOME = /home/user TAG = latest /bin/talosctl docs --config /tmp \
&& env HOME = /home/user TAG = latest /bin/talosctl docs --cli /tmp
FROM pseudomuto/protoc-gen-doc as proto-docs-build
COPY --from= generate-build /api /protos
COPY ./hack/protoc-gen-doc/markdown.tmpl /tmp/markdown.tmpl
RUN protoc \
-I/protos \
-I/protos/common \
-I/protos/health \
-I/protos/machine \
-I/protos/network \
-I/protos/os \
-I/protos/security \
-I/protos/time \
--doc_opt= /tmp/markdown.tmpl,api.md \
--doc_out= /tmp \
/protos/health/*.proto \
/protos/machine/*.proto \
/protos/network/*.proto \
/protos/os/*.proto \
/protos/security/*.proto \
/protos/time/*.proto
2019-12-24 23:23:52 +03:00
FROM scratch AS docs
2020-10-23 05:39:37 +03:00
COPY --from= docs-build /tmp/configuration.md /website/content/docs/v0.7/Reference/
COPY --from= docs-build /tmp/cli.md /website/content/docs/v0.7/Reference/
COPY --from= proto-docs-build /tmp/api.md /website/content/docs/v0.7/Reference/
2020-10-30 01:08:05 +03:00
# The talosctl-cni-bundle builds the CNI bundle for talosctl.
FROM scratch AS talosctl-cni-bundle
ARG TARGETARCH
COPY --from= extras-talosctl-cni-bundle-install /opt/cni/bin/ /talosctl-cni-bundle-${ TARGETARCH } /