mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 03:55:54 +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
|
ARG GO_VERSION=1.12
|
||||||
WORKDIR /go/src/github.com/securego/gosec
|
FROM golang:${GO_VERSION}-alpine AS builder
|
||||||
COPY . .
|
RUN apk add --update --no-cache ca-certificates make git curl
|
||||||
RUN apk add -U git make
|
RUN mkdir -p /build
|
||||||
RUN go get -u github.com/golang/dep/cmd/dep
|
WORKDIR /build
|
||||||
RUN make
|
COPY . /build/
|
||||||
|
RUN go mod download
|
||||||
|
RUN make build-linux
|
||||||
|
|
||||||
FROM golang:1.11.5-alpine3.9
|
FROM golang:${GO_VERSION}-alpine
|
||||||
RUN apk add -U gcc musl-dev
|
RUN apk add --update --no-cache ca-certificates git
|
||||||
COPY --from=build /go/src/github.com/securego/gosec/gosec /usr/local/bin/gosec
|
ENV GO111MODULE on
|
||||||
ENTRYPOINT ["gosec"]
|
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
|
BIN = gosec
|
||||||
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
||||||
IMAGE_REPO = securego
|
IMAGE_REPO = securego
|
||||||
BUILDFLAGS := ''
|
BUILDFLAGS := '-w -s'
|
||||||
CGO_ENABLED = 0
|
CGO_ENABLED = 0
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue