Docker deploy on macOS m1 arm: Service 'web' failed to build - Sharp error

Wappler Version : 4.4.2
Operating System : Mac M1
Server Model: NodeJS
Database Type: MariaDB
Hosting Type: Local Docker Project

Expected behavior

What do you think should happen?

I should be able to create a brand new Wappler project, and build following the normal steps:
Create folder
Project - New Project
Choose Folder, Choose NodeJS, Docker etc.

Actual behavior

What actually happens?

Service starts to run and tries to build but I get the following error every time. I have tried to create a new project 2/3 times now with the same error:

Bringing all services up ...
Building web
[+] Building 29.4s (8/9)                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                             0.0s
[+] Building 29.6s (8/9)                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                             0.0s
 => => transferring dockerfile: 85B                                                                                                              0.0s
[+] Building 29.7s (9/9) FINISHED                                                                                                                     
 => [internal] load build definition from Dockerfile                                                                                             0.0s
 => => transferring dockerfile: 85B                                                                                                              0.0s
 => [internal] load .dockerignore                                                                                                                0.0s
 => => transferring context: 82B                                                                                                                 0.0s
 => [internal] load metadata for docker.io/library/node:12-buster-slim                                                                           3.7s
 => [internal] load build context                                                                                                                0.0s
 => => transferring context: 157B                                                                                                                0.0s
 => [1/5] FROM docker.io/library/node:12-buster-slim@sha256:94d56d4c80b4aeacaffae06896c34c981b75679e491bf99f16ed017ca92cc15b                     0.0s
 => CACHED [2/5] WORKDIR /opt/node_app                                                                                                           0.0s
 => CACHED [3/5] COPY index.js .                                                                                                                 0.0s
 => CACHED [4/5] COPY package.json .                                                                                                             0.0s
 => ERROR [5/5] RUN npm install --no-optional                                                                                                   25.9s
------                                                                                                                                                
 > [5/5] RUN npm install --no-optional:                                                                                                               
#9 25.41                                                                                                                                              
#9 25.41 > sharp@0.29.3 install /opt/node_app/node_modules/sharp                                                                                      
#9 25.41 > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
#9 25.41                                                                                                                                              
#9 25.49 sharp: Installation error: Use with glibc 2.28 requires manual installation of libvips >= 8.11.3
#9 25.49 sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
#9 25.63 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
#9 25.63 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#9 25.63 
#9 25.66 npm ERR! code ELIFECYCLE
#9 25.66 npm ERR! errno 1
#9 25.66 npm ERR! sharp@0.29.3 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)`
#9 25.66 npm ERR! Exit status 1
#9 25.66 npm ERR! 
#9 25.66 npm ERR! Failed at the sharp@0.29.3 install script.
#9 25.66 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#9 25.68 
#9 25.68 npm ERR! A complete log of this run can be found in:
#9 25.68 npm ERR!     /root/.npm/_logs/2021-12-07T23_49_56_303Z-debug.log
------
executor failed running [/bin/sh -c npm install --no-optional]: exit code: 1
ERROR: Service 'web' failed to build : Build failed
Error Launching Services!

On Mac m1 you have to choose Debian 11 bullseye or Alpine as base for your NodeJS as the arm version of the Sharp library can compile only on those.

You can change that in your project target docker options.

We use sharp for image resizing, in the next update this will be also made optional, so it won’t be installed if you don’t do image resizing.

Ok interesting - this only started happening after the last 2 or 3 Wappler updates - I was able to create projects without issue before hand.

Can you point me towards where I would find project target docker options, please. Is this within Wappler, or Docker Desktop?

thank you guys - learnt something new today.

8 posts were split to a new topic: Docker deploy error: UnixHTTPConnectionPool Read timed out