Docker deployment

Hello everyone,

I am trying to deploy my wappler project using docker outside of wappler but I am not able to figure out how. The farthest I have reach is I navigate to the .wappler folder where the docker-compose.yml file is created and I run

docker-compose up --build

However it is always stuck at the step

[web  9/11] RUN npm install --no-package-lock

The error That i get is as follows

19.51 npm ERR! code 1
19.51 npm ERR! path /opt/node_app/node_modules/argon2
19.51 npm ERR! command failed
19.51 npm ERR! command sh -c -- node-gyp-build
19.51 npm ERR! gyp info it worked if it ends with ok
19.51 npm ERR! gyp info using node-gyp@9.1.0
19.51 npm ERR! gyp info using node@16.20.2 | linux | arm64
19.51 npm ERR! gyp ERR! find Python 
19.51 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
19.51 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
19.51 npm ERR! gyp ERR! find Python checking if "python3" can be used
19.51 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
19.51 npm ERR! gyp ERR! find Python checking if "python" can be used
19.51 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
19.51 npm ERR! gyp ERR! find Python 
19.51 npm ERR! gyp ERR! find Python **********************************************************
19.51 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
19.51 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
19.51 npm ERR! gyp ERR! find Python you can try one of the following options:
19.51 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
19.51 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
19.51 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
19.51 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
19.51 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
19.51 npm ERR! gyp ERR! find Python For more information consult the documentation at:
19.51 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
19.51 npm ERR! gyp ERR! find Python **********************************************************
19.51 npm ERR! gyp ERR! find Python 
19.51 npm ERR! gyp ERR! configure error 
19.51 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
19.51 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
19.51 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
19.51 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
19.51 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
19.51 npm ERR! gyp ERR! stack     at exithandler (node:child_process:410:5)
19.51 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
19.51 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
19.51 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
19.51 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
19.51 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
19.51 npm ERR! gyp ERR! System Linux 6.10.14-linuxkit
19.51 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
19.51 npm ERR! gyp ERR! cwd /opt/node_app/node_modules/argon2
19.51 npm ERR! gyp ERR! node -v v16.20.2
19.51 npm ERR! gyp ERR! node-gyp -v v9.1.0
19.51 npm ERR! gyp ERR! not ok

Any help would be very much appriciated.

Thank you.

I suspect you'd run into this problem even if you were deploying with Wappler

Can you post your Dockerfile?

Maybe NodeJS Docker images used to have Python installer and now they don't - maybe using a different NodeJS image could help, usually it's configured in the target settings

I am able to successfully deploy using Wappler. Here is my Dockerfile

FROM node:16-bullseye-slim

RUN apt-get update; apt-get -y install fontconfig
COPY ./fonts /usr/shared/fonts
COPY ./fonts /usr/share/fonts/truetype
# refresh system font cache
RUN fc-cache -f -v

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

ARG PORT=3000
ENV PORT $PORT
EXPOSE $PORT

RUN mkdir /opt/node_app
ENV PATH /opt/node_app/node_modules/.bin:$PATH

WORKDIR /opt/node_app

COPY package.json ./

RUN npm install --no-package-lock

COPY . .

ENV TZ=America/Toronto
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone


CMD [ "node", "./index.js" ]

There's only 2 ways that's possible:

  1. Wappler Docker is using an old, cached image that contains Python
  2. The docker-compose you're trying to deploy is using a different Docker image than the one used when deploying using Wappler

How can I check this? When I open my desktop docker, I am not able to see the image created by wappler. Does wappler create the image directly on the server?

I'm afraid I don't have any further guidance, sorry

Maybe Patrick from the Wappler team can help

P.S.: First check your docker-compose file if it's overriding the Docker image in Dockerfile

Install Portainer locally. It is in the Resource Manager. You can then see your images and containers. Register at Docker Hub to export what you need quickly and easily. I'm sure you can do this in Docker Desktop too, but will need to check...