mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 03:25:53 +00:00
Rework the Dockerfile for Go modules
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
806908a805
commit
7935fd85b9
2 changed files with 14 additions and 11 deletions
23
Dockerfile
23
Dockerfile
|
@ -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"]
|
||||
|
|
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ GIT_TAG?= $(shell git describe --always --tags)
|
|||
BIN = gosec
|
||||
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
||||
IMAGE_REPO = securego
|
||||
BUILDFLAGS := ''
|
||||
BUILDFLAGS := '-w -s'
|
||||
CGO_ENABLED = 0
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue