I have an npm package hosted on github. It's working fine while working on the local machine. But it's not installing while the docker build process.
Dockerfile
FROM node:14-alpine as base
EXPOSE 8080
ARG LIB_GITHUB_TOKEN
ENV NODE_ENV=production \
LIB_GITHUB_TOKEN="${LIB_GITHUB_TOKEN}"
WORKDIR /home/node/app
RUN chown -R node:node /home/node/app
COPY --chown=node:node package.json package-lock*.json tsconfig.json .npmrc ./
RUN npm install --only=development
RUN ls -a **every pkgs installed except gihub pvt pkg**
RUN cd node_modules/ && ls
RUN npm run build
.npmrc file
registry=https://registry.npmjs.org/
@github_user:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${LIB_GITHUB_TOKEN}
Every packages are installed except my GitHub private package.
Same working properly with docker-compose.
If I add npm ci --only=production in dockerfile. it gives -
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"