Skip to content

Commit 81f2e21

Browse files
committed
modifies dockerfile to create multiple python envs - making sure dependencies for checkov and semgrep match
1 parent da03743 commit 81f2e21

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

Dockerfile.scanner

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,33 @@ RUN CGO_ENABLED=0 make devguard-scanner
5555
FROM alpine:3.22.1@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
5656

5757
RUN apk add --no-cache git python3
58-
RUN python3 -m venv /usr/local/bin/venv && \
59-
/usr/local/bin/venv/bin/pip install --upgrade pip && \
60-
/usr/local/bin/venv/bin/pip install semgrep checkov
58+
# Create virtualenvs
59+
ENV VENV_DIR=/opt/tools
60+
RUN python -m venv ${VENV_DIR}/semgrep && \
61+
python -m venv ${VENV_DIR}/checkov
62+
63+
# Install semgrep in its venv
64+
RUN ${VENV_DIR}/semgrep/bin/pip install --upgrade pip && \
65+
${VENV_DIR}/semgrep/bin/pip install semgrep==1.131.0
66+
67+
# Install checkov in its venv
68+
RUN ${VENV_DIR}/checkov/bin/pip install --upgrade pip && \
69+
${VENV_DIR}/checkov/bin/pip install checkov==3.2.457
70+
71+
72+
RUN cat <<EOF > /usr/local/bin/semgrep
73+
#!/bin/sh
74+
exec ${VENV_DIR}/semgrep/bin/semgrep "\$@"
75+
EOF
76+
77+
RUN chmod +x /usr/local/bin/semgrep
78+
79+
RUN cat <<EOF > /usr/local/bin/checkov
80+
#!/bin/sh
81+
exec ${VENV_DIR}/checkov/bin/checkov "\$@"
82+
EOF
83+
84+
RUN chmod +x /usr/local/bin/checkov
6185

6286
# add venv bin to path
6387
ENV PATH="/usr/local/bin/venv/bin:$PATH"

0 commit comments

Comments
 (0)