sap-labs-france / ev-dashboard

The Open e-Mobility Charging Station management front-end Angular application (check also ev-server and ev-mobile)
https://open-e-mobility.fr/
Apache License 2.0
66 stars 102 forks source link

dockerfile (npm ERR! path /usr/builder) #3540

Open Stan92 opened 1 year ago

Stan92 commented 1 year ago

Hi, I get errors when creating an image with the dockerfile

make SUBMODULES_INIT=false

Building dashboard
[+] Building 164.4s (22/26)                                                                        
[+] Building 165.3s (22/26)                                                                        
[+] Building 363.4s (23/26)                                                                        
 => [internal] load build definition from Dockerfile                                          0.0s
 => => transferring dockerfile: 814B                                                          0.0s
 => [internal] load .dockerignore                                                             0.0s
 => => transferring context: 2B                                                               0.0s
 => [internal] load metadata for docker.io/library/nginx:alpine                               3.9s
 => [internal] load metadata for docker.io/library/node:16-alpine                             3.5s
 => [auth] library/nginx:pull token for registry-1.docker.io                                  0.0s
 => [auth] library/node:pull token for registry-1.docker.io                                   0.0s
 => [internal] load build context                                                             0.1s
 => => transferring context: 105.84kB                                                         0.1s
 => [builder  1/12] FROM docker.io/library/node:16-alpine@sha256:f1657204d3463bce763cefa5b25  0.0s
 => [stage-1 1/7] FROM docker.io/library/nginx:alpine@sha256:2e776a66a3556f001aba13431b26e44  0.0s
 => CACHED [stage-1 2/7] RUN [ -e /etc/nginx/conf.d/default.conf ] && mv /etc/nginx/conf.d/d  0.0s
 => CACHED [stage-1 3/7] COPY docker/nginx-dashboard.conf /etc/nginx/conf.d/dashboard.conf    0.0s
 => CACHED [stage-1 4/7] WORKDIR /usr/share/nginx/html                                        0.0s
 => CACHED [builder  2/12] WORKDIR /usr/builder                                               0.0s
 => CACHED [builder  3/12] COPY package.json ./                                               0.0s
 => [builder  4/12] COPY package-lock.json ./                                                 0.0s
 => [builder  5/12] RUN npm set progress=false && npm config set depth 0 && npm cache clean   2.0s 
 => [builder  6/12] RUN HUSKY_SKIP_INSTALL=1 npm install --force                             49.3s 
 => [builder  7/12] COPY NOTICE LICENSE ./                                                    0.0s
 => [builder  8/12] COPY src ./src                                                            0.2s
 => [builder  9/12] COPY *.json ./                                                            0.0s
 => [builder 10/12] COPY *.js ./                                                              0.0s
 => [builder 11/12] COPY docker/config.json ./src/assets/config.json                          0.0s
 => ERROR [builder 12/12] RUN npm run build:prod                                            307.1s
------
 > [builder 12/12] RUN npm run build:prod:
#0 0.722 
#0 0.722 > ev-dashboard@2.7.8 build:prod
#0 0.722 > npm version && cross-env NODE_OPTIONS="--max-old-space-size=4096" ng build --configuration production
#0 0.722 
#0 1.336 {
#0 1.336   'ev-dashboard': '2.7.8',
#0 1.336   npm: '8.19.4',
#0 1.336   node: '16.20.0',
#0 1.336   v8: '9.4.146.26-node.26',
#0 1.336   uv: '1.43.0',
#0 1.336   zlib: '1.2.11',
#0 1.336   brotli: '1.0.9',
#0 1.336   ares: '1.19.0',
#0 1.336   modules: '93',
#0 1.336   nghttp2: '1.47.0',
#0 1.336   napi: '8',
#0 1.336   llhttp: '6.0.10',
#0 1.336   openssl: '1.1.1t+quic',
#0 1.336   cldr: '41.0',
#0 1.336   icu: '71.1',
#0 1.336   tz: '2022f',
#0 1.336   unicode: '14.0',
#0 1.336   ngtcp2: '0.8.1',
#0 1.336   nghttp3: '0.7.0'
#0 1.336 }
#0 5.265 - Generating browser application bundles (phase: setup)...
#0 8.860 Warning: Entry point 'ngx-daterangepicker-material' contains deep imports into '/usr/builder/node_modules/dayjs/plugin/localeData', '/usr/builder/node_modules/dayjs/plugin/localizedFormat', '/usr/builder/node_modules/dayjs/plugin/isoWeek', '/usr/builder/node_modules/dayjs/plugin/weekOfYear', '/usr/builder/node_modules/dayjs/plugin/customParseFormat'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
#0 8.862 Processing legacy "View Engine" libraries:
#0 9.533 - angular2-chartjs [main/commonjs] (https://github.com/emn178/angular2-chartjs.git)
#0 10.18 - ngx-daterangepicker-material [es2015/esm2015] (https://github.com/fetrarij/ngx-daterangepicker-material.git)
#0 10.93 - @auth0/angular-jwt [es2015/esm2015] (git+https://github.com/auth0/angular2-jwt)
#0 11.86 - ng2-file-upload [es2015/esm2015] ()
#0 12.53 - ngx-google-places-autocomplete [main/umd] (git+https://github.com/skynet2/ngx-google-places-autocomplete)
#0 15.06 Encourage the library authors to publish an Ivy distribution.
------
Dockerfile:19
--------------------
  17 |     COPY docker/config.json ./src/assets/config.json
  18 |     
  19 | >>> RUN npm run build:${build}
  20 |     
  21 |     FROM nginx:alpine
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run build:${build}" did not complete successfully: exit code: 1
ERROR: Service 'dashboard' failed to build : Build failed
make: *** [Makefile:22: dashboard] Error 1

using this command docker build -t ev-dashboard --build-arg build=prod .

=> ERROR [builder 12/12] RUN npm run build:prod   

#0 175.4 npm ERR! path /usr/builder
#0 175.4 npm ERR! command failed
#0 175.4 npm ERR! signal SIGKILL
#0 175.4 npm ERR! command sh -c -- npm version &&  ng build --configuration production
#0 175.4 
#0 175.4 npm ERR! A complete log of this run can be found in:
#0 175.4 npm ERR!     /root/.npm/_logs/2023-05-31T18_52_30_149Z-debug-0.log

I can't figure out the problem :-( (Ubuntu 22.04)