Почему не работает docker build?

Добрый день,
Делаю все по гайду с сайта Docker. Скачал тестовый репозиторий, создал докерфайл, добавил необходимые настройки как в доке:
FROM node:18-alpine
WORKDIR /app
COPY . .
RUN yarn install --production
CMD ["node", "src/index.js"]
EXPOSE 3000


Дальше, если не вносить изменения в какие либо файлы проекта и ввести команду:
docker build -t getting-started .
То все работает. Но если я вношу какие либо изменения, например, двигаясь по доке из Docker я делаю правку текста в проекте (Part 3 - в документации), то вылазит ошибка:
> [4/4] RUN yarn install --ignore-engines:
0.355 yarn install v1.22.19
0.393 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
0.396 [1/4] Resolving packages...
0.819 [2/4] Fetching packages...
7.162 [3/4] Linking dependencies...
8.366 [4/4] Building fresh packages...
8.845 error /app/node_modules/sqlite3: Command failed.
8.845 Exit code: 1
8.845 Command: node-pre-gyp install --fallback-to-build
8.845 Arguments:
8.845 Directory: /app/node_modules/sqlite3
8.845 Output:
8.845 node-pre-gyp info it worked if it ends with ok
8.845 node-pre-gyp info using node-pre-gyp@1.0.10
8.845 node-pre-gyp info using node@18.18.2 | linux | x64
8.845 node-pre-gyp info check checked for "/app/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node" (not found)
8.845 node-pre-gyp http GET https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-musl-x64.tar.gz
8.845 node-pre-gyp ERR! install request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-musl-x64.tar.gz failed, reason: Client network socket disconnected before secure TLS connection was established
8.845 node-pre-gyp WARN Pre-built binaries not installable for sqlite3@5.1.2 and node@18.18.2 (node-v108 ABI, musl) (falling back to source compile with node-gyp)
8.845 node-pre-gyp WARN Hit error request to https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.2/napi-v6-linux-musl-x64.tar.gz failed, reason: Client network socket disconnected before secure TLS connection was established
8.845 gyp info it worked if it ends with ok
8.845 gyp info using node-gyp@8.4.1
8.845 gyp info using node@18.18.2 | linux | x64
8.845 gyp info ok
8.845 gyp info it worked if it ends with ok
8.845 gyp info using node-gyp@8.4.1
8.845 gyp info using node@18.18.2 | linux | x64
8.845 gyp ERR! find Python
8.845 gyp ERR! find Python Python is not set from command line or npm configuration
8.845 gyp ERR! find Python Python is not set from environment variable PYTHON
8.845 gyp ERR! find Python checking if "python3" can be used
8.845 gyp ERR! find Python - "python3" is not in PATH or produced an error
8.845 gyp ERR! find Python checking if "python" can be used
8.845 gyp ERR! find Python - "python" is not in PATH or produced an error
8.845 gyp ERR! find Python
8.845 gyp ERR! find Python **********************************************************
8.845 gyp ERR! find Python You need to install the latest version of Python.
8.845 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
8.845 gyp ERR! find Python you can try one of the following options:
8.845 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
8.845 gyp ERR! find Python   (accepted by both node-gyp and npm)
8.845 gyp ERR! find Python - Set the environment variable PYTHON
8.845 gyp ERR! find Python - Set the npm configuration variable python:
8.845 gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
8.845 gyp ERR! find Python For more information consult the documentation at:
8.845 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
8.845 gyp ERR! find Python **********************************************************
8.845 gyp ERR! find Python
8.845 gyp ERR! configure error
8.845 gyp ERR! stack Error: Could not find any Python installation to use
8.845 gyp ERR! stack     at PythonFinder.fail (/app/node_modules/node-gyp/lib/find-python.js:330:47)
8.845 gyp ERR! stack     at PythonFinder.runChecks (/app/node_modules/node-gyp/lib/find-python.js:159:21)
8.845 gyp ERR! stack     at PythonFinder.<anonymous> (/app/node_modules/node-gyp/lib/find-python.js:202:16)
8.845 gyp ERR! stack     at PythonFinder.execFileCallback (/app/node_modules/node-gyp/lib/find-python.js:294:16)
8.845 gyp ERR! stack     at exithandler (node:child_process:430:5)
8.845 gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:442:5)
8.845 gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
8.845 gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:290:12)
8.845 gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
8.845 gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
8.845 gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
8.845 gyp ERR! command "/usr/local/bin/node" "/app/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_mod
ules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/app/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=6" "--node_napi_label=napi-v6"
8.845 gyp ERR! cwd /app/node_modules/sqlite3
8.845 gyp ERR! node -v v18.18.2
8.845 gyp ERR! node-gyp -v v8.4.1
8.845 gyp ERR! not ok
8.845 node-pre-gyp ERR! build error
8.845 node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-buil
d --module=/app/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
8.845 node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
8.845 node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
8.845 node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
8.845 node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
8.845 node-pre-gyp ERR! System Linux 5.10.16.3-microsoft-standard-WSL2
8.845 node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"   
8.845 node-pre-gyp ERR! cwd /app/node_modules/sqlite3
8.845 node-pre-gyp ERR! node -v v18.18.2
8.845 node-pre-gyp ERR! node-pre-gyp -v v1.0.10
8.845 node-pre-gyp ERR! not ok
8.845 Failed to execute '/usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/sq
lite3/lib/binding/napi-v6-linux-musl-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/napi-v6-linux-musl-x64 --napi_version=9 --node_abi_napi=napi --napi_build_version=6 --node_napi_label=napi-v6' (1)
8.845 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
Dockerfile:4
--------------------
   2 |     WORKDIR /app
   3 |     COPY . .
   4 | >>> RUN yarn install --ignore-engines
   5 |     CMD ["node", "src/index.js"]
   6 |     EXPOSE 3000
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn install --ignore-engines" did not complete successfully: exit code: 1
  • Вопрос задан
  • 822 просмотра
Решения вопроса 1
E1ON
@E1ON
Programming, Gamedev, VR
Он хочет питон, а его нету в контейнере:

8.845 gyp ERR! find Python You need to install the latest version of Python.
8.845 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы