1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-29 22:37:59 +02:00

Rework the Dockerfile for Go modules

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar
2019-04-25 12:48:22 +02:00
committed by Cosmin Cojocar
parent 806908a805
commit 7935fd85b9
2 changed files with 14 additions and 11 deletions

View File

@@ -1,11 +1,14 @@
FROM golang:1.11.5-alpine3.9 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
ARG GO_VERSION=1.12
FROM golang:${GO_VERSION}-alpine AS builder
RUN apk add --update --no-cache ca-certificates make git curl
RUN mkdir -p /build
WORKDIR /build
COPY . /build/
RUN go mod download
RUN make build-linux
FROM golang:1.11.5-alpine3.9
RUN apk add -U gcc musl-dev
COPY --from=build /go/src/github.com/securego/gosec/gosec /usr/local/bin/gosec
ENTRYPOINT ["gosec"]
FROM golang:${GO_VERSION}-alpine
RUN apk add --update --no-cache ca-certificates git
ENV GO111MODULE on
COPY --from=builder /build/gosec /bin/gosec
ENTRYPOINT ["/bin/gosec"]