I have a RoR app that uses imagemagick specified in the Gemfile. I am using Docker's official rails image to build my image with the following Dockerfile:
FROM rails:onbuild
RUN apt-get install imagemagick
and get the following error:
Cant install RMagick 2.13.2. Cant find Magick-config in /usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Now, that's probably because the imagemagic package is missing on the OS, even though I specified it in my Dockerfile. So I guess the bundle install
command is issued before my RUN apt-get
command is issued.
My question - using this base image, is there a way to ensure imagemagic is installed prior to bundling?
Do I need to fork and change the base image Dockerfile to achieve that?
you are right, the
ONBUILD
instructions from the rails:onbuild image will be executed just after theFROM
instruction of your Dockerfile.What I suggest is to change your Dockerfile as follow:
which I made based on the rails:onbuild Dockerfile moving down the
ONBUILD
instructions and removing theONBUILD
flavor.Most packages clean out the cache to save on size. Try this:
Or spool up a copy of the container and look for yourself
The --remove will ensure that the container is removed after you exit the shell. Once in the shell look for the package binary (or dpkg --list)