Giter Site home page Giter Site logo

Comments (3)

alexjurkiewicz avatar alexjurkiewicz commented on June 30, 2024

The base image is 1.04gb.

  1. Removing docker & docker-compose saves 466mb
  2. Removing C/C++ toolchain (autoconf, build-essential, pkg-config, software-properties-common) saves 234mb
  3. Adding --no-install-recommends to main apt-get install saves 10mb
  4. Replacing vim with vim-tiny saves 53mb
  5. Removing dockerize saves 10mb
  6. Removing maria/pg libs saves 55mb

Final size is 212mb.

Packages you might want to re-add:

  • python3-minimal is 25mb (+10%)
  • maria/pg libs are +55mb (+25%)

from cimg-base.

felicianotech avatar felicianotech commented on June 30, 2024

Hi Alex,

Thank for opening this issue and all of the thought you put into it. I agree with your sentiment however I do want to explain that our philosophy on CI focused Docker images differs a bit from a production Docker image. We run over 35 million builds a month with customers doing everything in the world you could image. There's a balance we need to strike with the size of the image vs pre-installing tools that will help a majority of users. With Docker layer caching, it's often that although the image is larger, it's ultimately faster for the majority of users using Convenience Images.

For example, "Removing C/C++ toolchain", a lot of other Convenience Images need these tools for compiling what's in their image. Docker, Docker Compose, and dockerize are all frequently used tools on CircleCI. Especially Docker itself. It's ingrained in our documentation, some sample projects, and many tools. Removing them is just not currently an option.

There are good points you've made. For example, using --no-install-recommends will save us space in the image and is something we're going to do. We have an existing Issue for that already (#86). It's not completed yet because of backwards compatibility issues. This change will remove a number of packages that we need to properly communicate to customers before we make the change. It is on the list though.

vim-tiny - This is also a good suggestion. I opened a PR for it today (#99). Good catch.


Thank you for the suggestions. I'm going to close this Issue but we'll be paying attention to the size of images.

from cimg-base.

alexjurkiewicz avatar alexjurkiewicz commented on June 30, 2024

Thankyou for the response! Sorry for my slow reply.

You pointed out that it's impossible to make major changes (like removing Docker/build-essential) to such a widely used image. That is very true, and I should have realised it.

But I think you can remove these things from an image variant. For example, cimg/base:stable-slim is the same image without Docker or the build-essential. The existing image cimg/base:stable would be unchanged.

I think most cimg/base users would move to -slim variants happily for faster CI builds. You have the stats, maybe cimg/base is used by 95% C++ CI projects. I don't think so though :)

For example, "Removing C/C++ toolchain", a lot of other Convenience Images need these tools for compiling what's in their image.

If the toolchain is used to build other sub-images, it doesn't have to remain in the image for everyone to download. I am sure you are familiar with multi-stage build process:

FROM debian:stable as builder
RUN apt install build-essential
RUN wget redis.org/stable.tar.gz && ...

FROM cimg/base:stable as builder
COPY --from=builder /usr/local/redis /usr/local/redis

I actually couldn't see any cimg images that rely on C/C++ compilation, so I couldn't give you a real world example here. But I will happily write one if you point me at a use-case.

from cimg-base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.