This commit is contained in:
inductor
2019-09-19 19:12:50 +09:00
committed by Teppei Fukuda
parent 18de7e45e9
commit 4a21ad9540

View File

@@ -1,15 +1,15 @@
FROM golang:1.12-alpine AS builder
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
COPY go.mod go.sum /app/
WORKDIR /app/
RUN apk --no-cache add git upx
RUN go mod download
COPY . /app/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -a -o /trivy cmd/trivy/main.go
RUN go build -ldflags "-X main.version=$(git describe --tags --abbrev=0)" -a -o /trivy cmd/trivy/main.go
RUN upx --lzma --best /trivy
FROM alpine:3.9
RUN apk --no-cache add ca-certificates git
COPY --from=builder /trivy /usr/local/bin/trivy
RUN chmod +x /usr/local/bin/trivy
ENTRYPOINT ["trivy"]