Since about two days I’m trying to debug this issue that I have with imagemagick and I don’t know how to continue…
I’m running a rails server on a ruby docker image. Deployment has worked before adding the rmagick gem but since I added the rmagick gem it fails to deploy. At first the installation of ‘gem rmagick’ failed due to the lack of imagemagick. Then I added imagemagick libmagickwand-dev to the Dockerfile and looking at the logs I can see that rmagick installs successfully. However, when trying to run the server in the docker container I get this message:
LoadError: libMagickCore-6.Q16.so.6: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/3.1.0/gems/rmagick-5.0.0/lib/RMagick2.so
However, if I build the dockerfile locally and I go into it’s shell I can see that the file exists.
Also, when I try to run convert which is an imagemagick command, I get convert: not found even though I have installed the imagemagick package inside the Dockerfile.
Can anyone point me to a possible solution please? Thanks a lot!
YEEEESSSS! Thank you!!!
I wasn’t aware of the difference in the build packages and the deploy packages. I guess the FROM base as build_deps command makes the difference and prevents the imagemagick package to be available in the running container
Short version is: smaller images load faster. Some packages are only required at build time.
FROM base as build_depsstarts a separate image. FROM build_deps as gemsstarts yet another image. COPY --from=gems` copies specific directories from the gem directory to the base.
I am having a problem that might be related, and missing proper documentation.
#16 86.14 Running ‘configure’ for sqlite3 3.39.4… OK #16 86.14 Running ‘compile’ for sqlite3 3.39.4… OK #16 86.14 Running ‘install’ for sqlite3 3.39.4… OK #16 86.14 Activating sqlite3 3.39.4 (from #16 86.14 /app/vendor/bundle/ruby/3.1.0/gems/sqlite3-1.5.3/ports/x86_64-linux-gnu/sqlite3/3.39.4)… #16 86.14 #16 86.14 Could not configure the build properly (pkg_config). Please install either the #16 86.14 pkg-config utility or the pkg-config rubygem. #16 86.14 #16 86.14 *** extconf.rb failed *** #16 86.14 Could not create Makefile due to some reason, probably lack of necessary #16 86.14 libraries and/or headers. Check the mkmf.log file for more details. You may #16 86.14 need configuration options.
Sorry for the cross-post, but feeling it is better than opening a new one.
That problem can be addressed by adding pkg-config to the list of BUILD_PACKAGES. I’m not sure why @flov didn’t need this, but it doesn’t hurt to add it.
For sqlite3, you will also need to add a library to the DEPLOY_PACKAGES:
If you are just starting out, there are quite a few other changes required in order to use sqlite3 - you will need to create a volume, mount it, set an environment variable, and change when db:migrate is run.
If you are willing to give my new gem a try, delete your Dockerfile, fly.toml, .dockerignore, and lib/tasks/fly.rake and then run the following: