Skip to content

Commit

Permalink
feat: remove user instructions from docker (#222)
Browse files Browse the repository at this point in the history
As mentioned in the [Kics
repo](https://github.com/Checkmarx/kics/blob/master/Dockerfile#L34)
itself, "Ignore no User Cmd since 2ms container is stopped after scan"
  • Loading branch information
Baruch Odem (Rothkoff) committed Mar 11, 2024
1 parent d6039a5 commit 6c03103
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,9 @@ jobs:
uses: docker/setup-buildx-action@v3

- run: make build
- name: Run docker and check its output
run:
if docker run -v "$(pwd)":/repo -t checkmarx/2ms:latest git /repo | grep -A 5 "totalitemsscanned:"; then
echo "Docker ran as expected";
else
echo "Docker did not run as expected";
exit 1;
fi
- name: docker run
run: |
docker run -v "$(pwd)":/repo -t checkmarx/2ms:latest git /repo --report-path /output/results.json --ignore-on-exit results
kics:
runs-on: ubuntu-latest
Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# kics-scan disable=b03a748a-542d-44f4-bb86-9199ab4fd2d5,fd54f200-402c-4333-a5a4-36ef6709af2f
# disable kics Healthcheck result
# and "Missing User Instruction" since 2ms container is stopped after scan

# Builder image
FROM golang:1.20.5-alpine3.18 AS builder

Expand All @@ -10,17 +14,11 @@ COPY . .
RUN go build -o /app/2ms .

# Runtime image
# kics-scan disable=b03a748a-542d-44f4-bb86-9199ab4fd2d5
# ^^^^ disable kics Healthcheck result
FROM alpine:3.18

RUN apk add --no-cache git=2.40.1-r0

RUN addgroup -S 2ms && adduser -S 2ms -G 2ms
USER 2ms

RUN git config --global --add safe.directory /repo

COPY --from=builder /app/2ms /2ms
ENTRYPOINT ["/2ms"]

0 comments on commit 6c03103

Please sign in to comment.