Fail to build docker image for ors-map-client

Hello,
I am very happy to find Openrouteservice and this forum! I tried to run ORS map client on my own server. However, I failed and got some errors while I trying…

So I would like to ask help and please give me some advices to resolve these problems…
(Apologize for long error logs in advance)

First, I followed the “set up and run” guide in ors-map-client GitHub Readme.
(link: GitHub - GIScience/ors-map-client: Openrouteservice API web SPA client using VueJS, Vuetify and Vue2Leaflet)

  1. Here comes the first question: What value do I have to put for bitlyLogin in src/config/app-config.js? I have done is that I copied “Log in to the Bitly Connections Platform” URL(sign-in page of Bitly) and pasted.

  2. After configuration, I followed “Run with docker” section. I got the error as below while running a command “docker build --tag ors-map-client:local .”.

(skipped the succeeded part...)
28.47 .../node_modules/node-sass postinstall$ node scripts/build.js
28.60 .../node_modules/node-sass postinstall: Binary found at /opt/client/node_modules/.pnpm/node-sass@8.0.0/node_modules/node-sass/vendor/linux-arm64-93/binding.node
28.60 .../node_modules/node-sass postinstall: Testing binary
28.71 .../node_modules/node-sass postinstall: Binary has a problem: Error: Error loading shared library /opt/client/node_modules/.pnpm/node-sass@8.0.0/node_modules/node-sass/vendor/linux-arm64-93/binding.node: Exec format error
28.71 .../node_modules/node-sass postinstall:     at Object.Module._extensions..node (node:internal/modules/cjs/loader:1282:18)
28.71 .../node_modules/node-sass postinstall:     at Module.load (node:internal/modules/cjs/loader:1076:32)
28.71 .../node_modules/node-sass postinstall:     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
28.71 .../node_modules/node-sass postinstall:     at Module.require (node:internal/modules/cjs/loader:1100:19)
28.71 .../node_modules/node-sass postinstall:     at require (node:internal/modules/cjs/helpers:108:18)
28.71 .../node_modules/node-sass postinstall:     at module.exports (/opt/client/node_modules/.pnpm/node-sass@8.0.0/node_modules/node-sass/lib/binding.js:19:10)
28.71 .../node_modules/node-sass postinstall:     at Object.<anonymous> (/opt/client/node_modules/.pnpm/node-sass@8.0.0/node_modules/node-sass/lib/index.js:13:35)
28.71 .../node_modules/node-sass postinstall:     at Module._compile (node:internal/modules/cjs/loader:1198:14)
28.71 .../node_modules/node-sass postinstall:     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
28.71 .../node_modules/node-sass postinstall:     at Module.load (node:internal/modules/cjs/loader:1076:32) {
28.71 .../node_modules/node-sass postinstall:   code: 'ERR_DLOPEN_FAILED'
28.71 .../node_modules/node-sass postinstall: }
28.71 .../node_modules/node-sass postinstall: Building the binary locally
28.71 .../node_modules/node-sass postinstall: Building: /usr/local/bin/node /opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
28.76 .../node_modules/node-sass postinstall: gyp info it worked if it ends with ok
28.77 .../node_modules/node-sass postinstall: gyp verb cli [
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '/usr/local/bin/node',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   'rebuild',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '--verbose',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '--libsass_ext=',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '--libsass_cflags=',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '--libsass_ldflags=',
28.77 .../node_modules/node-sass postinstall: gyp verb cli   '--libsass_library='
28.77 .../node_modules/node-sass postinstall: gyp verb cli ]
28.77 .../node_modules/node-sass postinstall: gyp info using node-gyp@8.4.1
28.77 .../node_modules/node-sass postinstall: gyp info using node@16.20.1 | linux | arm64
28.77 .../node_modules/node-sass postinstall: gyp verb command rebuild []
28.77 .../node_modules/node-sass postinstall: gyp verb command clean []
28.77 .../node_modules/node-sass postinstall: gyp verb clean removing "build" directory
28.77 .../node_modules/node-sass postinstall: gyp verb command configure []
28.79 .../node_modules/node-sass postinstall: gyp verb find Python Python is not set from command line or npm configuration
28.79 .../node_modules/node-sass postinstall: gyp verb find Python Python is not set from environment variable PYTHON
28.79 .../node_modules/node-sass postinstall: gyp verb find Python checking if "python3" can be used
28.79 .../node_modules/node-sass postinstall: gyp verb find Python - executing "python3" to get executable path
28.79 .../node_modules/node-sass postinstall: gyp verb find Python - "python3" is not in PATH or produced an error
28.79 .../node_modules/node-sass postinstall: gyp verb find Python checking if "python" can be used
28.79 .../node_modules/node-sass postinstall: gyp verb find Python - executing "python" to get executable path
28.80 .../node_modules/node-sass postinstall: gyp verb find Python - "python" is not in PATH or produced an error
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python Python is not set from command line or npm configuration
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python Python is not set from environment variable PYTHON
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python checking if "python3" can be used
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python - "python3" is not in PATH or produced an error
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python checking if "python" can be used
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python - "python" is not in PATH or produced an error
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python **********************************************************
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python You need to install the latest version of Python.
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python you can try one of the following options:
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python   (accepted by both node-gyp and npm)
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python - Set the environment variable PYTHON
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python - Set the npm configuration variable python:
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python For more information consult the documentation at:
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python **********************************************************
28.80 .../node_modules/node-sass postinstall: gyp ERR! find Python
28.80 .../node_modules/node-sass postinstall: gyp ERR! configure error
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack Error: Could not find any Python installation to use
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at PythonFinder.fail (/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/lib/find-python.js:330:47)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at PythonFinder.runChecks (/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/lib/find-python.js:159:21)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at PythonFinder.<anonymous> (/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/lib/find-python.js:202:16)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at PythonFinder.execFileCallback (/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/lib/find-python.js:294:16)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at exithandler (node:child_process:410:5)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
28.80 .../node_modules/node-sass postinstall: gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
28.80 .../node_modules/node-sass postinstall: gyp ERR! System Linux 5.15.49-linuxkit-pr
28.80 .../node_modules/node-sass postinstall: gyp ERR! command "/usr/local/bin/node" "/opt/client/node_modules/.pnpm/node-gyp@8.4.1/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
28.80 .../node_modules/node-sass postinstall: gyp ERR! cwd /opt/client/node_modules/.pnpm/node-sass@8.0.0/node_modules/node-sass
28.80 .../node_modules/node-sass postinstall: gyp ERR! node -v v16.20.1
28.80 .../node_modules/node-sass postinstall: gyp ERR! node-gyp -v v8.4.1
28.80 .../node_modules/node-sass postinstall: gyp ERR! not ok
28.80 .../node_modules/node-sass postinstall: Build failed with error code: 1
28.80 .../node_modules/node-sass postinstall: Failed
28.80  ELIFECYCLE  Command failed with exit code 1.
------
Dockerfile:14
--------------------
  12 |
  13 |     # Only install production.
  14 | >>> RUN pnpm install
  15 |
  16 |     COPY build /opt/client/build
--------------------
ERROR: failed to solve: process "/bin/sh -c pnpm install" did not complete successfully: exit code: 1
  1. I modified Dockerfile as below (just add python3 installation code) and somehow docker image has been built.
# Multistage build
# 1. Stage: Build the app
FROM node:16-alpine as build-stage
WORKDIR /opt/client/

# System deps and app setup:
RUN apk --no-cache add 'build-base>=0.5' 'git>=2.38' \
    && apk --no-cache add python3 \
    && npm install -g 'pnpm@^7.30'

# Add diretories with necessary config files
COPY pnpm-lock.yaml package.json /opt/client/

# Only install production.
RUN pnpm install --only=prod

COPY build /opt/client/build
COPY src /opt/client/src
COPY config /opt/client/config
COPY .eslintignore pnpm-lock.yaml cypress.config.js .babelrc .eslintrc.js dev.html package.json .postcssrc.js /opt/client/

RUN pnpm build

# 2. Stage: Start server with needed files only
FROM nginx:stable-alpine as production-stage

RUN apk add --no-cache 'openssl>=3.0' 'bash>=5.1'  \
    && rm -rf /usr/share/nginx/html/*

USER nginx

COPY --from=build-stage /opt/client/static /usr/share/nginx/html/static
COPY --from=build-stage /opt/client/index.html /usr/share/nginx/html/
COPY templates/nginx.ors-map-client.conf.nginx /etc/nginx/conf.d/default.conf

CMD ["nginx", "-g", "daemon off;"]

However, I got the NGINX error in docker logs after running the docker container as below:

(also skipped succeeded logs...)
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2
nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)

I also tried docker-compose section and natively set up and run part and… failed.
Please tell me if I missed something or if there is anything you do not understand…!

Hi @jupyohong,

  1. bitly is a link shortener but is currently broken. See: this issue.

  2. did you try the docker compose installation as well (prob. won’t make much difference, but just in case)? docker compose build in root and docker compose up -d if it finishes…
    Will have to take a look later.

  3. Might be gone after image/dependencies are fixed.

More later

Hello! Thank you for your reply :slight_smile:

  1. bitly is a link shortener but is currently broken. See: this issue .

Okay, I understand that this is not working right now.

  1. did you try the docker compose installation as well (prob. won’t make much difference, but just in case)? docker compose build in root and docker compose up -d if it finishes… Will have to take a look later.

Yes, I already tried this. As you know, this does not work because docker-compose.yml depends on Dockerfile…

  1. Might be gone after image/dependencies are fixed.

Does this mean that I have to wait until the source code to be updated?

I am trying to fix the codes on my own… but hope to get this issue fixed before then :smiling_face_with_tear:

Hey @jupyohong,

yes, i thought in the docker command, different parameters might be used. But after i checked it, here it doesn’t make a difference apart from the restart policy and container/image name.

I just did a docker compose build --no-cache and everything worked as expected.
What OS are you working on? (i know that also shouldn’t make a difference with docker, but rarely still does)
Also which docker (desktop) version are you using?
Are you building on the latest changes in main?

Best regards

@amandus, thank you for your help despite of all these messy questions…! Still I got errors but hope to get better result and wrote some answers for your questions as below:

I just did a docker compose build --no-cache and everything worked as expected.

No, I did same job on main branch and v2.1.0 branch(which seems to be the latest release), but failed to build. You did with ors-map-client source(please look at the above, my post get hidden by system when I put same link in the post), right?

I am afraid that you are confusing with openrouteservice API source(I cannot post a link here too, but as I know, openrouteservice is different from ors-map-client).

What OS are you working on? (i know that also shouldn’t make a difference with docker, but rarely still does)

macOS Ventura (Version 13.5)

Also which docker (desktop) version are you using?

  • Docker desktop version: 4.21.1
  • Docker version: 24.0.2

Are you building on the latest changes in main?

Yes

yes, i build the image for the ors-map-client. Once you use a docker-compose.yml file the commands are usually the same everywhere, as you set the parameters in the file and not directly in a docker command.

Hm it might actually be this issue, where node-sass isn’t available from the registry in your country, and you have to add it manually(see last section in install):

Hm it might actually be this issue, where node-sass isn’t available from the registry in your country, and you have to add it manually(see last section in install):

Well, I am actually Korean(South Korea, of course) so this won’t be the issue…

Hi @jupyohong,

i think that still was a macOS related issue (could reproduce it in one docker build).
I’ve switched from node-sass to sass which hopefully works now.

Can you retry building with the latest changes from main? (prob. remove all related images and containers.)

1 Like

Wow, you made it! @amandus

Error has gone while building the docker image. I really appreciate your help and patience.
Unfortunately, there is a NGINX permission fail error, looks like below:

> docker logs --follow ors-map-client
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: can not modify /etc/nginx/conf.d/default.conf (read-only file system?)
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2
nginx: [emerg] mkdir() "/var/cache/nginx/client_temp" failed (13: Permission denied)

But it seems I can handle this issue for my own :wink:

Again, thank you very much!