Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive Docker Image Size when Installing Checkov and Python3-pip #6774

Open
yilas opened this issue Oct 15, 2024 · 0 comments
Open

Excessive Docker Image Size when Installing Checkov and Python3-pip #6774

yilas opened this issue Oct 15, 2024 · 0 comments
Labels
contribution requested This is a great feature idea, but we will need a contribution to get it added to Checkov.

Comments

@yilas
Copy link

yilas commented Oct 15, 2024

Describe the feature

The feature request is focused on optimizing the size of the Docker image when installing Checkov in a debian:12.7-slim base image. Currently, when adding python3-pip and Checkov, the image size grows significantly, which might not be ideal for use cases where smaller images are preferred, such as in CI/CD pipelines (which is my case 😄, tbh). It would be beneficial to have a more lightweight installation process for Checkov, or some guidance on how to reduce the image size effectively.

Example

With checkov

Here is an example of Dockerfile :

FROM debian:12.7-slim
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get full-upgrade -yq && apt-get autoremove -yq && apt-get clean && rm -rf /var/lib/apt/lists/* && \
    apt-get update && apt-get install -yq --no-install-recommends curl git gnupg jq python3-pip software-properties-common sudo unzip wget zip && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

RUN pip3 install checkov --break-system-packages

With python3-pip and Checkov

  • Layer 3: python3-pip installation (~344 MB)
  • Last layer: Checkov installation (~264 MB)

Total ~600 MB

With installation of checkov

Without checkov

Without installation of checkov

Additional context

None

Question

Is there any guidance or best practice to minimize the image size when installing Checkov and its dependencies, especially in resource-constrained environments? Any suggestions or recommendations would be highly appreciated.

@yilas yilas added the contribution requested This is a great feature idea, but we will need a contribution to get it added to Checkov. label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution requested This is a great feature idea, but we will need a contribution to get it added to Checkov.
Projects
None yet
Development

No branches or pull requests

1 participant