2019-08-01 00:47:55 +03:00
# syntax = docker/dockerfile-upstream:1.1.2-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
2019-08-07 01:08:27 +03:00
ARG GO_VERSION
# The tools target provides base toolchain for the build.
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" ]
2019-10-15 22:28:15 +03:00
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.21.0
2019-09-10 21:12:28 +03:00
RUN cd $( mktemp -d) \
&& go mod init tmp \
2019-09-12 17:32:42 +03:00
&& go get mvdan.cc/gofumpt/gofumports \
&& 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-08 22:29:14 +03:00
COPY --from= autonomy/protoc-gen-proxy:4a9e5da /protoc-gen-proxy /toolchain/bin/protoc-gen-proxy
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
RUN protoc -I/api --go_out= plugins = grpc:/api/common /api/common/common.proto
COPY ./api/os/os.proto /api/os/os.proto
2019-10-24 05:31:18 +03:00
RUN protoc -I/api --go_out= plugins = grpc:/api/os /api/os/os.proto
2019-10-21 21:21:46 +03:00
COPY ./api/security/security.proto /api/security/security.proto
RUN protoc -I/api --go_out= plugins = grpc:/api/security /api/security/security.proto
COPY ./api/machine/machine.proto /api/machine/machine.proto
RUN protoc -I/api --go_out= plugins = grpc:/api/machine /api/machine/machine.proto
COPY ./api/time/time.proto /api/time/time.proto
RUN protoc -I/api --go_out= plugins = grpc:/api/time /api/time/time.proto
COPY ./api/network/network.proto /api/network/network.proto
RUN protoc -I/api --go_out= plugins = grpc:/api/network /api/network/network.proto
2019-10-24 05:31:18 +03:00
# Genenrate api bits last so we have other proto files in place to satisfy the import
COPY ./api/api.proto /api/api.proto
RUN protoc -I/api --plugin= proxy --proxy_out= plugins = grpc+proxy:/api /api/api.proto
2019-07-21 21:27:15 +03:00
2019-07-13 03:24:51 +03:00
FROM scratch AS generate
2019-10-21 21:21:46 +03:00
COPY --from= generate-build /api/common/github.com/talos-systems/talos/api/common/common.pb.go /api/common/
2019-10-24 05:31:18 +03:00
COPY --from= generate-build /api/github.com/talos-systems/talos/api/api.pb.go /api/
2019-10-21 21:21:46 +03:00
COPY --from= generate-build /api/os/github.com/talos-systems/talos/api/os/os.pb.go /api/os/
COPY --from= generate-build /api/security/github.com/talos-systems/talos/api/security/security.pb.go /api/security/
COPY --from= generate-build /api/machine/github.com/talos-systems/talos/api/machine/machine.pb.go /api/machine/
COPY --from= generate-build /api/time/github.com/talos-systems/talos/api/time/time.pb.go /api/time/
COPY --from= generate-build /api/network/github.com/talos-systems/talos/api/network/network.pb.go /api/network/
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
2019-01-19 12:58:26 +03:00
COPY ./go.mod ./
COPY ./go.sum ./
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
2019-09-16 22:32:45 +03:00
COPY --from= generate /api ./api
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
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
2019-07-26 20:21:45 +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 } " -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
2019-08-02 02:01:31 +03:00
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
2019-07-16 18:09:35 +03:00
WORKDIR /src/internal/app/machined
2019-07-27 11:09:50 +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 } " -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
2019-07-13 03:24:51 +03:00
# The ntpd target builds the ntpd image.
FROM base AS ntpd-build
ARG SHA
ARG TAG
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/ntpd
2019-07-26 20:21:45 +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 } " -o /ntpd
2019-07-13 03:24:51 +03:00
RUN chmod +x /ntpd
2019-07-21 21:27:15 +03:00
2019-07-13 03:24:51 +03:00
FROM scratch AS ntpd
COPY --from= ntpd-build /ntpd /ntpd
ENTRYPOINT [ "/ntpd" ]
2019-10-24 05:31:18 +03:00
# The apid target builds the api image.
FROM base AS apid-build
ARG SHA
ARG TAG
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
WORKDIR /src/internal/app/apid
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 } " -o /apid
RUN chmod +x /apid
FROM scratch AS apid
COPY --from= apid-build /apid /apid
ENTRYPOINT [ "/apid" ]
2019-07-13 03:24:51 +03:00
# The osd target builds the osd image.
2018-12-20 09:22:05 +03:00
2019-04-19 05:31:43 +03:00
FROM base AS osd-build
2018-12-20 09:22:05 +03:00
ARG SHA
ARG TAG
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/osd
2019-07-26 20:21:45 +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 } " -o /osd
2018-12-20 09:22:05 +03:00
RUN chmod +x /osd
2019-07-21 21:27:15 +03:00
2018-12-20 09:22:05 +03:00
FROM scratch AS osd
COPY --from= osd-build /osd /osd
ENTRYPOINT [ "/osd" ]
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
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
2019-07-26 20:21:45 +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 } " -o /trustd
2018-12-20 09:22:05 +03:00
RUN chmod +x /trustd
2019-07-21 21:27:15 +03:00
2018-12-20 09:22:05 +03:00
FROM scratch AS trustd
COPY --from= trustd-build /trustd /trustd
ENTRYPOINT [ "/trustd" ]
2019-08-03 00:08:24 +03:00
# The networkd target builds the networkd image.
FROM base AS networkd-build
ARG SHA
ARG TAG
ARG VERSION_PKG = "github.com/talos-systems/talos/internal/pkg/version"
WORKDIR /src/internal/app/networkd
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 } " -o /networkd
RUN chmod +x /networkd
FROM scratch AS networkd
COPY --from= networkd-build /networkd /networkd
ENTRYPOINT [ "/networkd" ]
2019-07-13 03:24:51 +03:00
# The osctl targets build the osctl binaries.
2019-01-18 17:26:12 +03:00
2019-07-13 03:24:51 +03:00
FROM base AS osctl-linux-build
2018-12-20 09:22:05 +03:00
ARG SHA
ARG TAG
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/cmd/osctl
2019-07-26 20:21:45 +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 } " -o /osctl-linux-amd64
2019-07-13 03:24:51 +03:00
RUN chmod +x /osctl-linux-amd64
2019-07-21 21:27:15 +03:00
2019-07-13 03:24:51 +03:00
FROM scratch AS osctl-linux
COPY --from= osctl-linux-build /osctl-linux-amd64 /osctl-linux-amd64
2019-04-19 05:31:43 +03:00
2019-07-13 03:24:51 +03:00
FROM base AS osctl-darwin-build
2019-04-19 05:31:43 +03:00
ARG SHA
ARG TAG
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/cmd/osctl
2019-07-26 20:21:45 +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 } " -o /osctl-darwin-amd64
2019-07-13 03:24:51 +03:00
RUN chmod +x /osctl-darwin-amd64
2019-07-21 21:27:15 +03:00
2019-07-13 03:24:51 +03:00
FROM scratch AS osctl-darwin
COPY --from= osctl-darwin-build /osctl-darwin-amd64 /osctl-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
2019-10-29 16:40:47 +03:00
COPY --from= docker.io/autonomy/kernel:febbf49 /boot/vmlinuz /vmlinuz
COPY --from= docker.io/autonomy/kernel:febbf49 /boot/vmlinux /vmlinux
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
2019-10-29 16:40:47 +03:00
COPY --from= docker.io/autonomy/fhs:febbf49 / /rootfs
COPY --from= docker.io/autonomy/ca-certificates:febbf49 / /rootfs
COPY --from= docker.io/autonomy/containerd:febbf49 / /rootfs
COPY --from= docker.io/autonomy/cni:febbf49 / /rootfs
COPY --from= docker.io/autonomy/dosfstools:febbf49 / /rootfs
COPY --from= docker.io/autonomy/eudev:febbf49 / /rootfs
COPY --from= docker.io/autonomy/iptables:febbf49 / /rootfs
COPY --from= docker.io/autonomy/libressl:febbf49 / /rootfs
COPY --from= docker.io/autonomy/libseccomp:febbf49 / /rootfs
COPY --from= docker.io/autonomy/musl:febbf49 / /rootfs
COPY --from= docker.io/autonomy/runc:febbf49 / /rootfs
COPY --from= docker.io/autonomy/socat:febbf49 / /rootfs
COPY --from= docker.io/autonomy/syslinux:febbf49 / /rootfs
COPY --from= docker.io/autonomy/xfsprogs:febbf49 / /rootfs
COPY --from= docker.io/autonomy/util-linux:febbf49 /lib/libblkid.* /rootfs/lib
COPY --from= docker.io/autonomy/util-linux:febbf49 /lib/libuuid.* /rootfs/lib
COPY --from= docker.io/autonomy/kmod:febbf49 /usr/lib/libkmod.* /rootfs/lib
COPY --from= docker.io/autonomy/kernel:febbf49 /lib/modules /rootfs/lib/modules
2019-07-21 21:27:15 +03:00
COPY --from= machined /machined /rootfs/sbin/init
2019-10-24 05:31:18 +03:00
COPY images/apid.tar /rootfs/usr/images/
2019-07-21 21:27:15 +03:00
COPY images/ntpd.tar /rootfs/usr/images/
COPY images/osd.tar /rootfs/usr/images/
COPY images/trustd.tar /rootfs/usr/images/
2019-08-03 00:08:24 +03:00
COPY images/networkd.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-08-30 17:47:15 +03:00
COPY hack/containerd.toml /etc/containerd.toml
COPY hack/containerd.toml /etc/containerd-system.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
2019-10-15 05:03:38 +03:00
RUN mkdir -pv /rootfs/{ boot,usr/local/share,mnt}
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
COPY --from= rootfs / /rootfs
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
COPY --from= initramfs-archive /initramfs.xz /initramfs.xz
2019-04-19 05:31:43 +03:00
2019-08-09 06:45:13 +03:00
# The container target generates a docker image that can be used to run Talos
2019-04-19 05:31:43 +03:00
# in containers.
2019-08-09 06:45:13 +03:00
FROM scratch AS container
2019-07-21 21:27:15 +03:00
COPY --from= rootfs / /
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
FROM alpine:3.8 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 \
2019-06-26 05:25:57 +03:00
cdrkit \
qemu-img \
syslinux \
util-linux \
2019-11-04 09:28:10 +03:00
xfsprogs
2019-07-04 07:07:02 +03:00
COPY hack/installer/entrypoint.sh /bin/entrypoint.sh
2019-09-13 23:10:47 +03:00
COPY hack/installer/template.ovf /template.ovf
2019-05-16 02:14:30 +03:00
COPY --from= kernel /vmlinuz /usr/install/vmlinuz
2019-07-21 21:27:15 +03:00
COPY --from= rootfs /usr/lib/syslinux/ /usr/lib/syslinux
2019-05-16 02:14:30 +03:00
COPY --from= initramfs /initramfs.xz /usr/install/initramfs.xz
2019-07-13 03:24:51 +03:00
COPY --from= osctl-linux-build /osctl-linux-amd64 /bin/osctl
2019-04-19 05:31:43 +03:00
ARG TAG
ENV VERSION ${ TAG }
2019-09-23 12:04:03 +03:00
LABEL "alpha.talos.io/version" = " ${ VERSION } "
2019-04-19 05:31:43 +03:00
ENTRYPOINT [ "entrypoint.sh" ]
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
2019-08-09 06:45:13 +03:00
FROM golang:${GO_VERSION} AS unit-tests-race
2019-08-07 01:08:27 +03:00
COPY --from= base /src /src
COPY --from= base /go/pkg/mod /go/pkg/mod
WORKDIR /src
ENV GO111MODULE on
ARG TESTPKGS
2019-08-30 20:49:26 +03:00
RUN --mount= type = cache,target= /root/.cache/go-build go test -v -count 1 -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.
FROM base AS integration-test-build
ARG SHA
ARG TAG
ARG VERSION_PKG = "github.com/talos-systems/talos/pkg/version"
RUN --mount= type = cache,target= /.cache/go-build GOOS = linux GOARCH = amd64 go test -c \
-ldflags " -s -w -X ${ VERSION_PKG } .Name=Client -X ${ VERSION_PKG } .SHA= ${ SHA } -X ${ VERSION_PKG } .Tag= ${ TAG } " \
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
FROM scratch AS integration-test
COPY --from= integration-test-build /src/integration.test /integration-test
2019-07-13 03:24:51 +03:00
# The lint target performs linting on the source code.
FROM base AS lint
COPY hack/golang/golangci-lint.yaml .
2019-09-12 00:58:51 +03:00
ENV GOGC = 50
2019-07-26 20:21:45 +03:00
RUN --mount= type = cache,target= /.cache/go-build golangci-lint run --config golangci-lint.yaml
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
2019-08-28 00:45:59 +03:00
# The protolint target performs linting on Markdown files.
FROM base AS protolint
COPY prototool.yaml /src
RUN prototool lint --protoc-bin-path= /toolchain/bin/protoc --protoc-wkt-path= /toolchain/include .
2019-08-17 11:51:40 +03:00
# The markdownlint target performs linting on Markdown files.
FROM node:8.16.1-alpine AS markdownlint
RUN npm install -g markdownlint-cli
2019-08-17 19:55:48 +03:00
RUN npm i sentences-per-line
2019-08-17 11:51:40 +03:00
WORKDIR /src
COPY .markdownlint.json .
COPY docs .
2019-08-17 19:55:48 +03:00
RUN markdownlint --rules /node_modules/sentences-per-line/index.js .