add docker build

This commit is contained in:
zc
2021-09-07 14:21:39 +08:00
parent 3a4a58fdd5
commit 77a9956d91
3 changed files with 27 additions and 1 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
*.vs* *.vs*
*go.sum* *go.sum*
*kubescape* *kubescape*
*debug* *debug*
.idea

View File

@@ -126,6 +126,18 @@ go mod tidy && go build -o kubescape .
4. Enjoy :zany_face: 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 # Under the hood
## Tests ## Tests

13
build/Dockerfile Normal file
View File

@@ -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"]