dockerfiles icon indicating copy to clipboard operation
dockerfiles copied to clipboard

[nextcloud] Including imagemagick extension?

Open weikinhuang opened this issue 7 years ago • 11 comments

I've tried to add it to the build with:

BUILD_DEPS=... \
    imagemagick-dev \
    pcre-dev

NORMAL_APKS=...\
    imagemagick

pecl install ... \
    imagick

echo "extension=imagick.so" > /etc/php7.1/conf.d/imagick.ini

However everytime php runs (cli and fpm), I get a segmentation fault. Any help would be appreciated.

weikinhuang avatar Feb 24 '17 17:02 weikinhuang

I didn't want to integrate this extension because of many security issues in the past. Your approach is good so I don't see why you get a segmentation fault. Can you verify you're building at least the version 3.4.3? https://pecl.php.net/package-changelog.php?package=imagick&release=3.4.3RC4

Wonderfall avatar Feb 25 '17 01:02 Wonderfall

I am building 3.4.3 as that's the current head in pecl. Seems to be an issue with alpine maybe. As it doesn't work with php7-imagick when i replaced 7.1 with 7 in your image.

weikinhuang avatar Feb 25 '17 02:02 weikinhuang

I see... I don't have an explanation for now. Perhaps you're using AppArmor, SELinux or Grsec?

Wonderfall avatar Feb 25 '17 02:02 Wonderfall

I've tried it on my kubernetes cluster (CoreOS) and locally on boot2docker. Same issue, you can trigger the segmentation fault simply by doing php -i after enable imagick.

weikinhuang avatar Feb 25 '17 02:02 weikinhuang

I just built imagick for my image lychee and I don't have any segmentation fault (while I'm using apparmor). So I think it's likely coming from your side if it can help.

Wonderfall avatar Feb 26 '17 02:02 Wonderfall

did you try docker run -it IMAGE sh then php -i

weikinhuang avatar Feb 26 '17 02:02 weikinhuang

My bad. Just tried running before but I can confirm docker run -ti image php7.1 -i output ends with Segmentation fault (core dumped).

Can you try to compile from https://github.com/mkoppanen/imagick ? I'm going to bed so I don't have time right now.

Wonderfall avatar Feb 26 '17 02:02 Wonderfall

Imagick is used for previews in Nextcloud. It would be very nice to also have this in your image @Wonderfall. Maybe only as an option? If not, can you show an example of the best way to build upon your nextcloud image for extra php extensions.

ariselseng avatar Sep 01 '17 10:09 ariselseng

Mh, is imagick actually used by Nextcloud? I was not sure about that, though the documentation says it is.

A way to add imagick would be to add imagick to the pecl install list and then enable the extension just like I did for others. I'll take a look at that but first I'll have to get it working with Lychee.

Wonderfall avatar Sep 01 '17 23:09 Wonderfall

@Wonderfall Yes, I wasn't aware of that too. If you see here: https://github.com/nextcloud/server/search?utf8=%E2%9C%93&q=imagick&type= You will see a lot of references for imagick. It's mainly used for providing previews for files of certain filetypes. I use it a lot, along with my app: https://github.com/cowai/camerarawpreviews . Which gives previews to raw camera files as well as Adobe Indesign files, using "exiftool".

ariselseng avatar Sep 01 '17 23:09 ariselseng

hi, i think weikinhuang was right that alpine and imagick combined had some bugs, but i think they have been fixed. giving the build another try gave me a working wonderfall/nextcloud build with imagick enabled. theming works now as well. @Wonderfall are you willing to give it another shot and incorporate imagick into your build ? Your nextcloud image is working very well!

Tobias.

P.S. I also think to nake in a config option to switch imagick off. I personally need the imagick module only during theming setup. once that is done the module could be switched off as far as i am concerned for my usecase.

tob123 avatar Oct 29 '17 11:10 tob123