Docker compose не удается собрать - PullRequest
0 голосов
/ 30 апреля 2019

Я работаю над командным проектом, который имеет интегрированный dockerfile, и все, кто делает сборку docker-compose, работают правильно на Mac и Mint.Но на машине, на которой у меня установлена ​​Ubuntu 18.10, выдается следующая ошибка:

bcrypt_lib.target.mk:109: recipe for target 'Release/obj.target/bcrypt_lib/src/bcrypt_node.o' failed
make: Leaving directory '/tmp/cocoa/node_modules/bcrypt/build'
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt_node.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Linux 4.18.0-17-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/tmp/cocoa/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/tmp/cocoa/node_modules/bcrypt/lib/binding" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd /tmp/cocoa/node_modules/bcrypt
gyp ERR! node -v v12.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/tmp/cocoa/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/tmp/cocoa/node_modules/bcrypt/lib/binding --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/tmp/cocoa/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1000:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
node-pre-gyp ERR! System Linux 4.18.0-17-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/tmp/cocoa/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/cocoa/node_modules/bcrypt
node-pre-gyp ERR! node -v v12.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.2
node-pre-gyp ERR! not ok

У меня есть версия npm: 6.4.1, но на другой машине (ubuntu) версия NPM для Ubuntu: 5.8.0

Файл Docker:

FROM node:latest

ENV TERM=xterm-256color ENV PROJECT_NAME cocoa ENV PROJECT_ROOT
/opt/api

RUN mkdir -p /tmp/$PROJECT_NAME ADD package.json
/tmp/$PROJECT_NAME/package.json RUN cd /tmp/$PROJECT_NAME/ && npm
install RUN mkdir -p $PROJECT_ROOT RUN cp -a
/tmp/$PROJECT_NAME/node_modules $PROJECT_ROOT

WORKDIR $PROJECT_ROOT

COPY . $PROJECT_ROOT ARG environment COPY ./.env.${environment:-local}
$PROJECT_ROOT/.env COPY ./constants.js.${environment:-local}
$PROJECT_ROOT/src/config/constants.js

EXPOSE 8080

RUN ["chmod", "+x", "./bin/start.sh"]

CMD ["./bin/start.sh"]

Файл Docker-Compose:

version: "2.1"

services:   # BUSINESS API   api:

    build: ./api

    ports:
      - "8080:8080"
    environment:
      - API_PORT=8080
      - DB_HOST=api-db
    volumes:
      - ./api/src:/opt/api/src
    links:
      - api-db
    external_links:
      - potatoes_api_1
    networks:
      - potatoes_default
    depends_on:
      api-db:
        condition: service_healthy

  # API DB   api-db:

    image: mysql:5.7.22
    ports:
      - "3306:3306"
    volumes:
      - api-db-volume:/var/lib/mysql
    environment:
      MYSQL_USER: shadow
      MYSQL_PASSWORD: abc789
      MYSQL_ROOT_PASSWORD: abc789
      MYSQL_DATABASE: shadow_express
    healthcheck:
      test: "/usr/bin/mysql --user=root --password=abc789 --execute \"SHOW DATABASES;\""
      interval: 3s
      timeout: 1s
      retries: 5 volumes:   api-db-volume:   # queue-db-volume: networks:   potatoes_default:
      external: true
...