Hello, I'm doing the pipeline deployment for publishing image nodejs container on Docker and inside my nodejs dependency have one private bitbucket repository. I can able to build an run docker install this on my own local docker. But when I try to run on pipelines, it failed on step npm install although I can see it can connect ssh. Here is my docker file
Note: Error is npm fetch 404 for this private package
FROM node:18.20.0-alpine3.19 as srcBuild
ARG STAGE
WORKDIR /api
RUN apk update && apk add openssh-client git
COPY id_rsa_model /root/.ssh/id_rsa
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts
RUN chmod 600 /root/.ssh/id_rsa
RUN eval $(ssh-agent) && ssh-add /root/.ssh/id_rsa
RUN ssh -T git@bitbucket.org
COPY package*.json ./
RUN npm install --verbose
COPY ./ ./
# ENV STAGE_ENV $STAGE
ENTRYPOINT ["sh", "-c" , "npm run start:dev -- $0 $@"]
My dependency
"my-dependency": "git+ssh://git@bitbucket.org/owner/my-dependency.git#v0.0.1"
Hi @Tinh Nguyen,
Welcome to the community.
Instead of using the COPY command to pass your existing SSH key in the Docker container, would it be possible for you to use an environment variable instead?
Here's an existing knowledge-based article for the same: Passing SSH key variable from Bitbucket Pipelines to a Dockerfile
Hope it helps.
Regards,
Mark C
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.