Can anyone explain why switching from node:14-alpine to node:16-alpine would cause npm install to fail?
> [ 8/10] RUN --mount=type=ssh npm i:
#14 14.27 npm ERR! code 128
#14 14.28 npm ERR! An unknown git error occurred
#14 14.28 npm ERR! command git --no-replace-objects ls-remote ssh://[email protected]/(somerepo).git
#14 14.28 npm ERR! Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
#14 14.28 npm ERR! [email protected]: Permission denied (publickey).
#14 14.28 npm ERR! fatal: Could not read from remote repository.
#14 14.28 npm ERR!
#14 14.28 npm ERR! Please make sure you have the correct access rights
#14 14.28 npm ERR! and the repository exists.
This is a:
git+ssh://[email protected]:someorg/somerepo
dependency. And the build is run using:
DOCKER_BUILDKIT=1 docker build --ssh default .
I couldn't find any obvious changes in the image, which makes me suspect npm (gone from 6.14.15 to 8.1.0), but I can't find anything documented (and it works fine, outside the container)
EDIT: the Dockerfile looks like this:
# syntax=docker/dockerfile:experimental
FROM node:16-alpine
RUN apk --no-cache --virtual build-dependencies add \
python2 \
make \
g++ \
git \
openssh
# Download public key for github.com
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
ssh-keyscan github.com >> /root/.ssh/known_hosts
WORKDIR /app/
RUN chown -R node $PWD
RUN apk add postgresql-client
ADD ./service/package.json .
RUN --mount=type=ssh npm i
RUN apk del build-dependencies && rm -r /root/.ssh
ADD ./service/ .
CMD node ./app.js
USER node
the only change I made was the FROM
EDIT 2: if I update npm (to 8.1.3) in the node 14 image, I get the same problem. but running ssh -Tv [email protected] fails even in the working version, so I have no idea what dark magic build kit has been using up till now
this seems to be an issue with npm8, and git+ssh
use yarn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With