Skip to content

Commit 5f0f8f8

Browse files
author
Amber Wiens
committed
Adding Docker container and changing README
1 parent 1beec25 commit 5f0f8f8

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Builds the Gas scanner with 'docker build' command, and runs Gas on all Go
2+
# files in your current directory with 'docker run' command.
3+
#
4+
# Docker version must be 17.05 or higher to allow multistage build
5+
#
6+
7+
FROM golang:1.8.1-alpine as builder
8+
ENV workspace /go/src/github.com/GoASTScanner/gas
9+
COPY . $workspace
10+
WORKDIR $workspace
11+
12+
RUN go vet $(go list ./... | grep -v /vendor/)
13+
RUN CGO_ENABLED=0 go build -o gas .
14+
15+
FROM alpine:3.6
16+
17+
LABEL MAINTAINER="David Graves <[email protected]>"
18+
19+
COPY --from=builder /go/src/github.com/GoASTScanner/gas/gas /
20+
21+
# Mounted directory should be placed into the workdir
22+
CMD /gas $(find . -path ./vendor -prune -o -type f -name "*.go")

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,20 @@ file. The output format is controlled by the '-fmt' flag, and the output file is
112112
# Write output in json format to results.json
113113
$ gas -fmt=json -out=results.json *.go
114114
```
115+
116+
### Docker container
117+
118+
A Dockerfile is included with the Gas source code to provide a container that
119+
allows users to easily run Gas on their code. It builds Gas, then runs it on
120+
all Go files in your current directory. Use the following commands to build
121+
and run locally:
122+
123+
To build: (run command in cloned Gas source code directory)
124+
docker build --build-arg http_proxy --build-arg https_proxy
125+
--build-arg no_proxy -t goastscanner/gas:latest .
126+
127+
To run: (run command in desired directory with Go files)
128+
docker run -v $PWD:$PWD --workdir $PWD goastscanner/gas:latest
129+
130+
Note: Docker version 17.05 or later is required (to permit multistage build).
131+
```

0 commit comments

Comments
 (0)