Skip to content

Commit 18ebfa3

Browse files
committed
feat: use the go-rpmdb tool for RPM scanning
Bump the snyk-docker-plugin to the version that integrates RPM DB analysis. This requires building the go-rpmdb tool and embedding it in the image: this is done as a separate build stage.
1 parent b1dc9ac commit 18ebfa3

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

Dockerfile

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ RUN cd $GOPATH/src/github.com/containers/skopeo \
1010
&& make install
1111

1212
#---------------------------------------------------------------------
13-
# STAGE 2: Build the kubernetes-monitor
13+
# STAGE 2: Build the go-rpmdb tool.
14+
#---------------------------------------------------------------------
15+
FROM golang:1.13.1-alpine3.10 AS rpmdb-build
16+
17+
RUN apk --no-cache add git gcc musl-dev db-dev openssl-dev
18+
RUN git clone --depth 1 -b 'v1.1.0' https://github.com/snyk/go-rpmdb $GOPATH/src/github.com/snyk/go-rpmdb
19+
RUN cd $GOPATH/src/github.com/snyk/go-rpmdb \
20+
&& GIT_COMMIT=$(git rev-parse HEAD 2> /dev/null || true) \
21+
&& GO111MODULE=on go build -ldflags "-X main.gitCommit=${GIT_COMMIT}" -o rpmdb ./cmd/rpmdb
22+
23+
#---------------------------------------------------------------------
24+
# STAGE 3: Build the kubernetes-monitor
1425
#---------------------------------------------------------------------
1526
FROM node:dubnium-alpine
1627

@@ -31,6 +42,9 @@ COPY --from=skopeo-build /usr/bin/skopeo /usr/bin/skopeo
3142
COPY --from=skopeo-build /etc/containers/registries.d/default.yaml /etc/containers/registries.d/default.yaml
3243
COPY --from=skopeo-build /etc/containers/policy.json /etc/containers/policy.json
3344

45+
RUN apk --no-cache add db
46+
COPY --from=rpmdb-build /go/src/github.com/snyk/go-rpmdb/rpmdb /usr/bin/rpmdb
47+
3448
WORKDIR /root
3549

3650
# Add manifest files and install before adding anything else to take advantage of layer caching

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"needle": "^2.4.0",
4242
"response-time": "^2.3.2",
4343
"snyk-config": "^2.2.0",
44-
"snyk-docker-plugin": "^1.32.1",
44+
"snyk-docker-plugin": "^1.33.0",
4545
"source-map-support": "^0.5.9",
4646
"tslib": "^1.9.3",
4747
"ws": "^7.0.0",

0 commit comments

Comments
 (0)