diff --git a/.gitignore b/.gitignore index ee144d5..f282cda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,12 @@ +# transient files +/image + # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a *.so *.swp +/gosec # Folders _obj diff --git a/Dockerfile b/Dockerfile index 8bdf431..24c089d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM golang:1.10.3-alpine3.8 +FROM golang:1.10.4-alpine3.8 as build +WORKDIR /go/src/github.com/securego/gosec +COPY . . +RUN apk add -U git make +RUN go get -u github.com/golang/dep/cmd/dep +RUN make -ENV BIN=gosec -ENV GOROOT=/usr/local/go -ENV GOPATH=/go - -COPY $BIN /go/bin/$BIN -COPY docker-entrypoint.sh /usr/local/bin - -ENTRYPOINT ["docker-entrypoint.sh"] +FROM golang:1.10.4-alpine3.8 +RUN apk add -U gcc musl-dev +COPY --from=build /go/src/github.com/securego/gosec/gosec /usr/local/bin/gosec +ENTRYPOINT ["gosec"] diff --git a/Makefile b/Makefile index 1aca3df..1ed0069 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ release: bootstrap build-linux: CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o $(BIN) ./cmd/gosec/ -image: build-linux +image: @echo "Building the Docker image..." docker build -t $(IMAGE_REPO)/$(BIN):$(GIT_TAG) . docker tag $(IMAGE_REPO)/$(BIN):$(GIT_TAG) $(IMAGE_REPO)/$(BIN):latest diff --git a/README.md b/README.md index 713ee7e..e438750 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ You can run the `gosec` tool in a container against your local Go project. You j `GOPATH` of the container: ``` -docker run -it -v $GOPATH/src/:/go/src/ securego/gosec /go/src/ +docker run -it -v $GOPATH/src/:/go/src/ securego/gosec ./... ``` #### Generate TLS rule diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh deleted file mode 100755 index 52bb267..0000000 --- a/docker-entrypoint.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -${BIN} "$@"