mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-30 05:18:11 +01:00
cabc5dad9c
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
41 lines
848 B
Docker
41 lines
848 B
Docker
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 \
|
|
ca-certificates \
|
|
git \
|
|
gcc \
|
|
libc-dev \
|
|
libgcc \
|
|
make
|
|
|
|
# Get go deps for tests etc.
|
|
RUN go get honnef.co/go/tools/cmd/staticcheck \
|
|
github.com/golang/lint/golint \
|
|
github.com/google/go-cmp/cmp
|
|
|
|
WORKDIR /go/src/k8scan
|
|
|
|
COPY *.go /go/src/k8scan/
|
|
|
|
RUN set -x \
|
|
&& go get -d . \
|
|
&& gofmt -s -l . \
|
|
&& go vet ./... \
|
|
&& golint ./... \
|
|
&& staticcheck ./... \
|
|
&& go test ./... \
|
|
&& CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /usr/bin/k8scan *.go \
|
|
&& echo "Build complete."
|
|
|
|
FROM r.j3ss.co/masscan
|
|
|
|
COPY --from=builder /usr/bin/k8scan /usr/bin/k8scan
|
|
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
|
|
|
|
ENTRYPOINT [ "k8scan" ]
|
|
CMD [ "--help" ]
|