lumeland / imagemagick-deno

Deno port of the WASM library for ImageMagick
https://deno.land/x/imagemagick_deno
42 stars 3 forks source link

Docker build #1

Closed Sn0wAlice closed 1 year ago

Sn0wAlice commented 1 year ago

Hello

This may be a stupid question, but, i have a project that use this module, and when i push it to a Docker container based on latest deno image, deno fail. And i don't know why.

If you have any idea how to help…. I am interested.

Have a great day

oscarotero commented 1 year ago

No idea. Does it work fine if it's runned out of a docker container? What error do you got?

Sn0wAlice commented 1 year ago

Yep fine if no docker.

Do error, just deno exit randomly just after the start of the script

After search, it's seem like the module install is not correct on docker... I will investigate on this part tomorow

Sn0wAlice commented 1 year ago

Add this to the docker file seems to solve the problem


# update 
apt-get update
# install curl 
apt-get install curl, git
# get install script and pass it to execute: 
curl -sL https://deb.nodesource.com/setup_4.x | bash
# and install node 
apt-get install nodejs
# confirm that it was successful 
node -v
# npm installs automatically 
npm -v

git clone https://github.com/lumeland/imagemagick-deno

# Clean old files
rm -rf deno
rm -rf magick-wasm
rm -rf package
rm magick-wasm.tgz
rm test/unsplash-blur.jpg

# Clone the repo
git clone --depth 1 --branch 0.0.17 https://github.com/dlemstra/magick-wasm.git

# Download the wasm file
npm install @dlemstra/magick-native

# Run the script
deno run --unstable --allow-write --allow-read to_deno.js

# Copy the wasm code
cp node_modules/@dlemstra/magick-native/magick.js deno/src/wasm/magick_native.js
echo "\nexport default MagickNative;" >> deno/src/wasm/magick_native.js

# Autoformat the code
deno fmt deno --ignore=deno/src/wasm/magick_native.js
oscarotero commented 1 year ago

Oh, are you importing the package by cloning the git repo? That code is just to generate the different versions. You only need to import the code from https://deno.land/x/imagemagick_deno/mod.ts.

Sn0wAlice commented 1 year ago

i have no chose, by importing from deno, this may crash my container. IDK why...

Sn0wAlice commented 1 year ago

fun fact: in a docker container under 240mbram | 140mVCPU, the docker will crash :)