2018-07-05 22:39:14 +02:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
MAINTAINER Jessica Frazelle <jess@linux.com>
|
|
|
|
|
|
|
|
ENV PATH /go/bin:/usr/local/go/bin:$PATH
|
|
|
|
ENV GOPATH /go
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
2018-07-14 00:15:51 +02:00
|
|
|
ca-certificates \
|
|
|
|
git \
|
|
|
|
gcc \
|
|
|
|
libc-dev \
|
|
|
|
libgcc \
|
|
|
|
make
|
2018-07-05 22:39:14 +02:00
|
|
|
|
2018-07-14 00:15:51 +02:00
|
|
|
# Get go deps for tests etc.
|
|
|
|
RUN go get honnef.co/go/tools/cmd/staticcheck \
|
2018-10-22 23:17:01 +02:00
|
|
|
golang.org/x/lint/golint \
|
2018-07-14 00:15:51 +02:00
|
|
|
github.com/google/go-cmp/cmp
|
|
|
|
|
|
|
|
WORKDIR /go/src/k8scan
|
|
|
|
|
|
|
|
COPY *.go /go/src/k8scan/
|
2018-07-05 22:39:14 +02:00
|
|
|
|
|
|
|
RUN set -x \
|
|
|
|
&& go get -d . \
|
2018-07-13 23:56:53 +02:00
|
|
|
&& gofmt -s -l . \
|
|
|
|
&& go vet ./... \
|
|
|
|
&& golint ./... \
|
|
|
|
&& staticcheck ./... \
|
|
|
|
&& go test ./... \
|
2018-07-05 22:39:14 +02:00
|
|
|
&& CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /usr/bin/k8scan *.go \
|
|
|
|
&& echo "Build complete."
|
|
|
|
|
2018-07-14 01:23:01 +02:00
|
|
|
FROM r.j3ss.co/masscan
|
2018-07-05 22:39:14 +02:00
|
|
|
|
|
|
|
COPY --from=builder /usr/bin/k8scan /usr/bin/k8scan
|
|
|
|
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
|
|
|
|
|
2018-07-09 17:41:47 +02:00
|
|
|
ENTRYPOINT [ "k8scan" ]
|
2018-07-13 23:56:53 +02:00
|
|
|
CMD [ "--help" ]
|