I have this docker-compose file :
rest-api:
image: x/rest-api
build:
context: ./rest-api/dockerfiles/
dockerfile: local.Dockerfile
environment:
- BUILD_ENV=local
ports:
- "8001:8001"
volumes:
- ./rest-api:/var/www/rest-api
user: $UID
web:
image: x/web-front
build:
context: ./web-front
dockerfile: dockerfiles/local.Dockerfile
environment:
- BUILD_ENV=local
depends_on:
- rest-api
links:
- rest-api
ports:
- "3001:3001"
- "35729:35729"
volumes:
- ./web-front:/var/www/web-front
- ./web-front/logs/:/root/.npm/
user: $UID
and these 2 local.Dockerfile. rest-api:
FROM node:8-alpine
RUN mkdir -p /var/www/rest-api/
WORKDIR /var/www/rest-api/
EXPOSE 8001
CMD [ "npm", "run", "dev" ]
web-front:
FROM node:8-alpine
RUN mkdir -p /var/www/twasker-web-front/
WORKDIR /var/www/twasker-web-front/
EXPOSE 3001 35729
CMD [ "npm", "run", "local" ]
I basically install my all my node_modules from the host, then map the volume to the corresponding folder in the container for both rest-api and web-front. Then I run commands in my package.json from the container. I experience no issue for the rest-api. On web-front thought, the process exits with Segmentation fault (core dumped) and error code 139
CMD [ "npm", "run", "local" ]
runs :
"NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1",
When I run npm run local
directly on my computer I don'thave this issue. I already tried a npm rebuild
with no success node version on the container is the same as the one on the host. I have this debug :
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'local' ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 verbose run-script [ 'prelocal', 'local', 'postlocal' ]
5 info lifecycle web-front@0.5.0~prelocal: web-front@0.5.0
6 silly lifecycle web-front@0.5.0~prelocal: no script for prelocal, continuing
7 info lifecycle web-front@0.5.0~local: web-front@0.5.0
8 verbose lifecycle web-front@0.5.0~local: unsafe-perm in lifecycle true
9 verbose lifecycle web-front@0.5.0~local: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/var/www/web-front/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
10 verbose lifecycle web-front@0.5.0~local: CWD: /var/www/web-front
11 silly lifecycle web-front@0.5.0~local: Args: [ '-c',
11 silly lifecycle 'NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1' ]
12 silly lifecycle web-front@0.5.0~local: Returned: code: 139 signal: null
13 info lifecycle web-front@0.5.0~local: Failed to exec local script
14 verbose stack Error: web-front@0.5.0 local: `NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1`
14 verbose stack Exit status 139
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at EventEmitter.emit (events.js:213:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:125:13)
14 verbose stack at ChildProcess.emit (events.js:213:7)
14 verbose stack at maybeClose (internal/child_process.js:887:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
15 verbose pkgid web-front@0.5.0
16 verbose cwd /var/www/web-front
17 verbose Linux 4.4.0-66-generic
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "local"
19 verbose node v8.0.0
20 verbose npm v5.0.0
21 error code ELIFECYCLE
22 error errno 139
23 error web-front@0.5.0 local: `NODE_ENV=local ./node_modules/gulp/bin/gulp.js dev --location=local --env=dev --livereload=1`
23 error Exit status 139
24 error Failed at the web-front@0.5.0 local script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 139, true ]
Do you have any idea of where this error comes from ? Thanks in advance.
via valvince
No comments:
Post a Comment