Skip to content

Commit 7017242

Browse files
committed
refactor Dockerfile to install semgrep and gitleaks
Signed-off-by: Rafi <refaei.shikho@hotmail.com>
1 parent 7209328 commit 7017242

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

Dockerfile.scanner

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,39 @@ FROM golang:1.24.0 AS golang-builder
33
# set the working directory
44
WORKDIR /app
55

6-
# like linux/amd64
76
ARG TARGETPLATFORM
87

9-
COPY install_devguard_scanner_deps.sh .
8+
ENV CRANE_VERSION=v0.19.1
9+
ENV OS=Linux
10+
ENV ARCH=x86_64
1011

11-
RUN ./install_devguard_scanner_deps.sh ${TARGETPLATFORM}
12+
13+
14+
RUN curl -sL "https://github.com/google/go-containerregistry/releases/download/${CRANE_VERSION}/go-containerregistry_${OS}_${ARCH}.tar.gz" > go-containerregistry.tar.gz && \
15+
tar -zxvf go-containerregistry.tar.gz -C /usr/local/bin/ crane
16+
17+
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.58.1
18+
19+
20+
RUN curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64" && mv cosign-linux-amd64 /usr/local/bin/cosign && chmod +x /usr/local/bin/cosign
21+
22+
RUN curl -sL "https://github.com/semgrep/semgrep/archive/refs/tags/v1.117.0.tar.gz" > semgrep.tar.gz && \
23+
tar -zxvf semgrep.tar.gz -C /usr/local/bin/ semgrep
1224

1325
COPY . .
1426

1527
# build the scanner
1628
RUN CGO_ENABLED=0 make devguard-scanner
1729
# ----------------------
1830
# create final image with node:alpine
19-
FROM alpine:3.20.2@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5
31+
FROM zricethezav/gitleaks:v8.24.2@sha256:b5918eb91b8d2473cec722f066abb4352e4ffdc4ec9f4283ec143aba9ec9ebc4
2032

2133
RUN apk add --no-cache git
2234

2335
COPY --from=golang-builder /app/devguard-scanner /usr/local/bin/devguard-scanner
2436
COPY --from=golang-builder /usr/local/bin/trivy /usr/local/bin/trivy
2537
COPY --from=golang-builder /usr/local/bin/cosign /usr/local/bin/cosign
2638
COPY --from=golang-builder /usr/local/bin/crane /usr/local/bin/crane
39+
COPY --from=golang-builder /usr/local/bin/semgrep /usr/local/bin/semgrep
2740

2841
ENTRYPOINT [""]

0 commit comments

Comments
 (0)