diff --git a/.gitignore b/.gitignore index bd035f19..089ebd2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.vs* *go.sum* *kubescape* -*debug* \ No newline at end of file +*debug* +.idea \ No newline at end of file diff --git a/README.md b/README.md index d9ae5510..f251c5c3 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,18 @@ go mod tidy && go build -o kubescape . 4. Enjoy :zany_face: +# How to build in Docker + +1. Clone Project +``` +git clone git@github.com:armosec/kubescape.git kubescape && cd "$_" +``` + +2. Build +``` +docker build -t kubescape -f build/Dockerfile . +``` + # Under the hood ## Tests diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 00000000..d54d28a1 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,13 @@ +FROM golang:1.16-alpine as builder +ENV GOPROXY=https://goproxy.io,direct +ENV GO111MODULE=on + +WORKDIR /work +ADD . . +RUN go mod download +RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w " -installsuffix cgo -o kubescape . + +FROM alpine +COPY --from=builder /work/kubescape /usr/bin/kubescape + +CMD ["kubescape"]