snibgo wrote: ↑2019-06-21T08:51:04-07:00
This question seems to be about building IM, and entirely unrelated to the thread, so I'm moving it to a new thread.
Sorry, I know nothing about Docker, Alpine etc.
Seth wrote:Whenever I attempt to do a command for example `/home/imagemagick/bin/identify --version`, it just says the command "...: not found".
Is that file in that directory? What does "ls" say?
Sorry about that, and thank you.
Message is slightly different as I moved from the alpine image to bash image. (so from bin/sh to bin/bash)
Instead of `not found` it's `No such file or directory`
Would just like to make clear, the `FROM gcc:9.1.0` without changing prefix and performing ldconfig. It's only once it's moved to the other image (now bash, based on alpine) that it does the following:
Code: Select all
seth@Rogeliina:~/Desktop/git/Elypia/elypia-emotes$ sudo docker run -it registry.gitlab.com/elypia/elypia-emotes/imagemagick
bash-5.0$ ls
bin etc include lib share
bash-5.0$ cd bin
bash-5.0$ pwd
/home/imagemagick/bin
bash-5.0$ ls
Magick++-config MagickWand-config compare conjure display import magick-script montage
MagickCore-config animate composite convert identify magick mogrify stream
bash-5.0$ ./identify --version
bash: ./identify: No such file or directory
bash-5.0$
EDIT: Just noticed the comment regarding Docker/Alpine.
The rest is just a verbose explanation of what I've tried, if it at all helps, and may be worth ignoring depending on how much you know.
Normally with Docker I would just use Alpine (a 5MB Linux distribution), install ImageMagick, and then save that as an image. Then whenever I'd want to build the emotes, I'd just run the image which is 40~MB and build the emotes then throw the image away.
It's really quick and simple to use and wonderful for setting up continuous integration. (So on commit, the repo will automatically set off a pipeline, that will use this image and execute the scripts in order to build all the emotes and upload them somewhere, though it's normally used for testing/building/deploying software.)
Image size is very important when using Docker and it's always good to build an image with as small a size as possible, this is both more secure as the image has less on it, including less tools that could aid in compromising security (granted somewhat irrelevant in this case), and faster to download/upload.
Because of this, Docker provides a feature called builder images, now that I want a custom configuration for ImageMagick, I need to compile it myself, but including a compiler and such in the emote image would make it too large and bulky, not to mention isn't required for the actual job of building the emotes, so we use a builder image instead which allows me to temporary use an image to perform a job, and then take something out of that image and move it into the one I'm actually building.
So in this case I take an image that has the C/C++ compiler/debug tools in order to build ImageMagick, then I pull an nice, small bash image which has nothing but Alpine and bash on it so I can move the compiled ImageMagick to it. This way I can compile and have ImageMagick, but don't have to have the C++ compiler/debug tools as well with the emotes, this allows me to continue having a small size, and my pipeline (CI) to download the image as fast as possible.
However, this seems to not be working correctly, it works perfectly if I used ImageMagick from where it was installed in the GCC image, but when ImageMagick is then moved to another image, I seem to get a different problem.
The line at the bottom:
`COPY --from=builder /home/imagemagick/ /home/imagemagick/`
Is saying, from the image `builder` (which is the GCC image that I actually used to compile ImageMagick), move everything from the `/home/imagemagick/` (what --prefix is set to) folder in that image, to the `/home/imagemagick/` folder in my bash image. (So the bin, etc, include, lib, and share folders are moved over.)