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

libvips & libvips-dev with docker makes the docker image so large #370

Open
houssemFat opened this issue Sep 12, 2023 · 2 comments
Open

Comments

@houssemFat
Copy link

Hi, thank you for the fantastic work with libvips.

I'm not sure if this is the right repo to report my issue but any help would be appreciated .

I'm using ruby-vips (with active storage for rails) in a docker based on ruby:3.1.3-slim-bullseye. For that, i need to install libvips-dev or libvips (I tested the both). The result docker image size is too large and when i did some inspection i noticed that libvips layer takes a considerable size. I created simple docker file for testing purpose.

Env Mac :
MacOs Big Sur , V 11.6 (20G165) , MacBook Air (M1, 2020)
Docker version 20.10.13

** Ubuntu :**
Ubuntu 22.04.1 LTS
Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3

test Dockerfile for libvips-dev :

FROM ruby:3.1.3-slim-bullseye

RUN bash -c "set -o pipefail  && apt-get update "

RUN bash -c "apt-get install -y libvips-dev"

ENTRYPOINT ["tail", "-f", "/dev/null"]

#CMD ["sh", "-c", "echo 'test'"]

Inspection result

image

I tested the use case with libvips with the example below :

Simple Dockerfile to reproduce the same use case with libvips :

FROM ruby:3.1.3-slim-bullseye

RUN bash -c "set -o pipefail  && apt-get update "

RUN bash -c "set -o pipefail && apt-get install -y libvips"

ENTRYPOINT ["tail", "-f", "/dev/null"]

image

@jcupitt
Copy link
Member

jcupitt commented Sep 13, 2023

Hi @houssemFat,

The libvips package on Debian recommends the libvips GUI, which in turn brings in most of X. Try --no-install-recommends.

You don't need libvips-dev, you can just use plain libvips.

I see:

$ docker run -it --rm --entrypoint /bin/bash ruby:3.1.3-slim-bullseye 
root@b651079273de:/# apt update && apt upgrade
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
...
root@b651079273de:/# apt install libvips
Reading package lists... Done
...
Need to get 129 MB/135 MB of archives.
After this operation, 507 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
^C

But with --no-install-recommends it's:

root@b651079273de:/# apt install libvips --no-install-recommends
Reading package lists... Done
...
Need to get 37.4 MB/40.5 MB of archives.
After this operation, 146 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

Then install ruby-vips with:

root@b651079273de:/# apt install build-essential
Reading package lists... Done
...
root@b651079273de:/# gem install ruby-vips
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Successfully installed ruby-vips-2.1.4
2 gems installed
root@b651079273de:/# 

You need build-essential to get the C compiler for the FFI gem.

@houssemFat
Copy link
Author

houssemFat commented Sep 13, 2023

Hi @jcupitt , thank you for your response. I replaced apt-get install -y --no-install-recommends libvips, the layer size is about 130MB now which very nice comparing to old size. Thank you for your time again.

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

2 participants