mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
32 lines
668 B
Docker
32 lines
668 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
|
||
|
|
||
|
COPY main.go /go/src/k8scan/
|
||
|
|
||
|
RUN set -x \
|
||
|
&& apk add --no-cache --virtual .build-deps \
|
||
|
git \
|
||
|
gcc \
|
||
|
libc-dev \
|
||
|
libgcc \
|
||
|
make \
|
||
|
&& cd /go/src/k8scan/ \
|
||
|
&& go get -d . \
|
||
|
&& CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o /usr/bin/k8scan *.go \
|
||
|
&& apk del .build-deps \
|
||
|
&& rm -rf /go \
|
||
|
&& echo "Build complete."
|
||
|
|
||
|
FROM scratch
|
||
|
|
||
|
COPY --from=builder /usr/bin/k8scan /usr/bin/k8scan
|
||
|
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
|
||
|
|
||
|
CMD [ "k8scan" ]
|