mirror of
https://github.com/securego/gosec.git
synced 2024-12-26 04:25:52 +00:00
Merge pull request #133 from awiens/master
Adding Docker container and updating README
This commit is contained in:
commit
f22c701483
2 changed files with 40 additions and 0 deletions
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Docker version must be 17.05 or higher to allow multistage build
|
||||||
|
# See build and run instructions in README.md
|
||||||
|
|
||||||
|
# Builds Gas for utilization
|
||||||
|
FROM golang:1.8.1-alpine as builder
|
||||||
|
ENV workspace /go/src/github.com/GoASTScanner/gas
|
||||||
|
ENV GOPATH /go
|
||||||
|
COPY . $workspace
|
||||||
|
WORKDIR $workspace
|
||||||
|
|
||||||
|
RUN go vet $(go list ./... | grep -v /vendor/)
|
||||||
|
RUN CGO_ENABLED=0 go build -o gas .
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
|
||||||
|
# Runs Gas on all Go files in the current directory when
|
||||||
|
# 'docker run' command in README is given
|
||||||
|
FROM alpine:3.6
|
||||||
|
|
||||||
|
COPY --from=builder /go/src/github.com/GoASTScanner/gas/gas /
|
||||||
|
|
||||||
|
# Mounted directory should be placed into the workdir
|
||||||
|
CMD /gas $(find . -path ./vendor -prune -o -type f -name "*.go")
|
17
README.md
17
README.md
|
@ -112,3 +112,20 @@ file. The output format is controlled by the '-fmt' flag, and the output file is
|
||||||
# Write output in json format to results.json
|
# Write output in json format to results.json
|
||||||
$ gas -fmt=json -out=results.json *.go
|
$ gas -fmt=json -out=results.json *.go
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Docker container
|
||||||
|
|
||||||
|
A Dockerfile is included with the Gas source code to provide a container that
|
||||||
|
allows users to easily run Gas on their code. It builds Gas, then runs it on
|
||||||
|
all Go files in your current directory. Use the following commands to build
|
||||||
|
and run locally:
|
||||||
|
|
||||||
|
To build: (run command in cloned Gas source code directory)
|
||||||
|
docker build --build-arg http_proxy --build-arg https_proxy
|
||||||
|
--build-arg no_proxy -t goastscanner/gas:latest .
|
||||||
|
|
||||||
|
To run: (run command in desired directory with Go files)
|
||||||
|
docker run -v $PWD:$PWD --workdir $PWD goastscanner/gas:latest
|
||||||
|
|
||||||
|
Note: Docker version 17.05 or later is required (to permit multistage build).
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue