@@ -22,6 +22,23 @@ COPY ./services/apps/git_integration/src/crowdgit/services/software_value/ ./
2222# Build the binary
2323RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o software-value ./
2424
25+ # Go builder stage 2: build the vulnerability-scanner binary
26+ FROM golang:1.25-alpine AS go-vuln-builder
27+
28+ WORKDIR /go/src/vulnerability-scanner
29+
30+ # Copy module files first for dependency caching
31+ COPY ./services/apps/git_integration/src/crowdgit/services/vulnerability_scanner/go.mod ./
32+ COPY ./services/apps/git_integration/src/crowdgit/services/vulnerability_scanner/go.sum ./
33+
34+ # Copy source code
35+ COPY ./services/apps/git_integration/src/crowdgit/services/vulnerability_scanner/ ./
36+
37+ # Download dependencies and build, using cache mounts to avoid re-downloading on every build
38+ RUN --mount=type=cache,target=/go/pkg/mod \
39+ --mount=type=cache,target=/root/.cache/go-build \
40+ go mod download && CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o vulnerability-scanner ./
41+
2542# Builder stage: install build dependencies, uv, and dependencies
2643FROM base AS builder
2744
@@ -84,13 +101,17 @@ COPY --from=builder /usr/crowd/app /usr/crowd/app
84101COPY --from=go-builder /go/src/software-value/software-value /usr/local/bin/software-value
85102COPY --from=go-builder /go/bin/scc /usr/local/bin/scc
86103
104+ # Copy vulnerability-scanner binary from go-vuln-builder stage
105+ COPY --from=go-vuln-builder /go/src/vulnerability-scanner/vulnerability-scanner /usr/local/bin/vulnerability-scanner
106+
87107# Add virtual environment bin to PATH
88108ENV PATH="/usr/crowd/app/.venv/bin:$PATH"
89109
90110# Make runner script and binaries executable
91111RUN chmod +x ./src/runner.sh \
92112 && chmod +x /usr/local/bin/software-value \
93- && chmod +x /usr/local/bin/scc
113+ && chmod +x /usr/local/bin/scc \
114+ && chmod +x /usr/local/bin/vulnerability-scanner
94115
95116EXPOSE 8085
96117
0 commit comments