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
WORKDIR /app
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
ENV TZ=“Europe/Berlin”
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.
But this is not a good solution in my opinion, because i am splitting up my dockerfile into two parts AND one part is also inside my drone file.
It works, but i really dont like it.
But this shows to me, that i can build the image on the pipeline, but the docker plugin for the pipeline cannot access my private npm registry