From c88d4d2135037ecbfd6a38895c4c3336e7dd253b Mon Sep 17 00:00:00 2001 From: Chen Keinan Date: Tue, 26 Oct 2021 13:47:41 +0300 Subject: [PATCH] feat: add docker file --- Dockerfile | 24 ++++++++++++++++++++++++ Makefile | 6 +++++- README.md | 9 +++++++++ go.mod | 4 ++-- go.sum | 10 ++++------ 5 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b141334 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Use an official golang runtime as a parent image +FROM golang:1.15-alpine as builder + +ENV GO111MODULE=on + +ADD . /src + +RUN apk --no-cache add ca-certificates wget + + +WORKDIR /src/cmd/mesh + +RUN wget https://github.com/chen-keinan/mesh-kridik/releases/download/v1.0.1/mesh-kridik_1.0.1_x64.tar.gz -O mesh-kridik.tar.gz +RUN tar xzf mesh-kridik.tar.gz + +FROM golang:1.15-alpine + +RUN apk --no-cache add ca-certificates + +WORKDIR /root/ + +COPY --from=builder /src/cmd/mesh/mesh-kridik . + +CMD ["./mesh-kridik"] diff --git a/Makefile b/Makefile index 474ec00..cad414d 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,12 @@ build_travis: GOOS=linux GOARCH=amd64 $(GOBUILD) -v ./cmd/mesh-kridik; build_remote: $(GOPACKR) - GOOS=linux GOARCH=amd64 $(GOBUILD) -v -gcflags='-N -l' ./cmd/mesh-kridik + GOOS=linux GOARCH=amd64 $(GOBUILD) -v ./cmd/mesh-kridik mv mesh-kridik ~/boxes/basic_box/mesh-kridik + +build_docker_local: + docker build -t chenkeinan/mesh-kridik:3 . + docker push chenkeinan/mesh-kridik:3 dlv: dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient exec ./mesh-kridik build_beb: diff --git a/README.md b/README.md index aea0e31..b8834e9 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,15 @@ Execute tests and generate failure tests report and it remediation's ./mesh-kridik -r ``` +## mesh-kridik as Docker + +Execute mesh-kridik via docker + +```shell +docker run --pid=host -v $HOME/.kube:/root/.kube:ro -v $(which kubectl):/usr/bin/kubectl -t chenkeinan/mesh-kridik +``` + + ## Istio Security Checks diff --git a/go.mod b/go.mod index 05c64d4..21b26bb 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ replace github.com/chen-keinan/go-opa-validate => github.com/chen-keinan/go-opa- require ( github.com/briandowns/spinner v1.16.0 - github.com/chen-keinan/go-command-eval v0.0.13 + github.com/chen-keinan/go-command-eval v0.0.14 github.com/chen-keinan/go-user-plugins v0.0.4 github.com/gobuffalo/packr v1.30.1 github.com/golang/mock v1.6.0 @@ -20,6 +20,6 @@ require ( github.com/stretchr/testify v1.7.0 go.uber.org/fx v1.13.1 go.uber.org/zap v1.19.1 - golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect + golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 162bbae..4f3ef07 100644 --- a/go.sum +++ b/go.sum @@ -81,8 +81,8 @@ github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cb github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= github.com/chen-keinan/go-command-eval v0.0.2/go.mod h1:fpE+yYOq5AAybeT2iLG0v30o0L/2NtOHbEUtufWstk0= -github.com/chen-keinan/go-command-eval v0.0.13 h1:hvWU90Dkv3Rj9WhtQiP5zWEcGCrkSdShVXjfQ6lxh7E= -github.com/chen-keinan/go-command-eval v0.0.13/go.mod h1:loXIYs1azoPeksQ0bUvHHEBByoEU3BNjZU4HvvMYPUg= +github.com/chen-keinan/go-command-eval v0.0.14 h1:wK6pbd1XOmbOxEnDiEx7+jFS9c0IOP/ZTvEwwheFTNs= +github.com/chen-keinan/go-command-eval v0.0.14/go.mod h1:loXIYs1azoPeksQ0bUvHHEBByoEU3BNjZU4HvvMYPUg= github.com/chen-keinan/go-opa-validate v0.0.6 h1:EJ7y+KoOGd/WLLGKwil0vtDKvIt5yPTSnz1I9fbaZxo= github.com/chen-keinan/go-opa-validate v0.0.6/go.mod h1:ntu4OB8A6Ni3oyAdiWfwqUBTU8J2gS9K0HC2dk7n0gU= github.com/chen-keinan/go-user-plugins v0.0.4 h1:0csMIC6TFLLVA4g5T+RRXXPnw/Dsr8nRgypIE9ZNEXw= @@ -545,7 +545,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -673,8 +672,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211013075003-97ac67df715c h1:taxlMj0D/1sOAuv/CbSD+MMDof2vbyPTqz5FNYKpXt8= -golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -755,7 +754,6 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=