mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
refactor: improved Dockerfile (#672)
This commit is contained in:
parent
4b0315c90a
commit
0752503872
1 changed files with 7 additions and 4 deletions
11
Dockerfile
11
Dockerfile
|
@ -1,13 +1,16 @@
|
|||
FROM golang:bullseye as builder
|
||||
FROM --platform=${BUILDPLATFORM} golang:bullseye as builder
|
||||
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build -a -o trufflehog main.go
|
||||
ENV CGO_ENABLED=0
|
||||
ARG TARGETOS TARGETARCH
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o trufflehog .
|
||||
|
||||
FROM alpine:3.15
|
||||
RUN apk add --no-cache git
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=builder /build/trufflehog /usr/bin/trufflehog
|
||||
ENTRYPOINT ["/usr/bin/trufflehog"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue