I have a problem when I want to build a docker image with the docker plugin. Everything works fine when I use it “normally”, but when I need to access a private npm registry from my Dockfile, I get an error.
I have a drone file, which just builds a docker image from a Dockerfile and uploads it into a private docker registry.
This Dockerfile looks like this and is there to build a vue js app.
FROM node:latest as build-stage
COPY package*.json ./
COPY .npmrc ./
RUN npm config set strict-ssl false
RUN npm install
COPY ./ .
RUN npm run build
FROM nginx:1.20 as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
CMD [“nginx”, “-g”, “daemon off;”]
The problem now is that I need to use a custom npm registry to pull the node packages from.
(thats why i use the .npmrc file)
It may or may not be the answer you’re looking for, but I had a similar issue with my private registry (Verdaccio).
Turns out, I was running into firewall issues.
I never dug into the nitty-gritty of the issue, but adding a rule in the firewall so my build system’s public IP can access my private repository enabled me to build docker containers in my pipelines with a private registry.