-
-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor Dockerfile into multi-stage
First stage does the build in a pristine alpine environment. Second stage is a minimal image with just the necessary stuff to run the compiled binary. Also added packages for gcc and musl-dev so cgo can do its thang. Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
- Loading branch information
Showing
2 changed files
with
10 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
FROM golang:1.10.4-alpine3.8 | ||
|
||
COPY gosec /usr/local/bin | ||
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 | ||
|
||
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters