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

Optimize Dockerfiles for faster and smaller builds #350

Closed
tdruez opened this issue Oct 20, 2021 · 2 comments
Closed

Optimize Dockerfiles for faster and smaller builds #350

tdruez opened this issue Oct 20, 2021 · 2 comments

Comments

@tdruez
Copy link
Contributor

tdruez commented Oct 20, 2021

Current sizes:

  • Uncompressed: scancodeio-images-v30.0.1.tar - 5.15 GB
  • Compressed: scancodeio-images-v30.0.1.tar.gz - 1.76 GB

Some ideas at https://testdriven.io/blog/docker-best-practices/ and https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

tdruez added a commit that referenced this issue Oct 20, 2021
tdruez added a commit that referenced this issue Oct 20, 2021
Signed-off-by: Thomas Druez <[email protected]>
tdruez added a commit that referenced this issue Oct 20, 2021
tdruez added a commit that referenced this issue Oct 20, 2021
tdruez added a commit that referenced this issue Oct 20, 2021
@tdruez
Copy link
Contributor Author

tdruez commented Oct 20, 2021

From 1.76 GB to 713M for the compressed tarball with current changes in the https://github.com/nexB/scancode.io/tree/350-docker-optimizations branch
Also, the build is much faster and leverage caching.

@tdruez
Copy link
Contributor Author

tdruez commented Oct 22, 2021

Step 8/9 : RUN --mount=type=cache,target=/root/.cache/pip pip install .
ERROR: Service 'web' failed to build : the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled

The following requires BuildKit which is not always enabled depending on the Docker version

# Cache Python packages on the local machine
RUN --mount=type=cache,target=/root/.cache/pip pip install .

tdruez added a commit that referenced this issue Oct 22, 2021
tdruez added a commit that referenced this issue Oct 22, 2021
@tdruez tdruez closed this as completed Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant