Background:
- I'm writing code in
node.js
, usingnpm
anddocker
. I'm trying to get my docker file to use cache when I build it so it doesn't take too long. - We have a "common" repo that we use to keep logic that is used in a variety of repositories and this gets propagated is npm packages.
The problem:
I want the docker file NOT use the cache on my "common" package.
Docker file:
FROM node:12-alpine as X
RUN npm i npm@latest -g
RUN mkdir /app && chown node:node /app
WORKDIR /app
RUN apk add --no-cache python3 make g++ tini \
&& apk add --update tzdata
USER node
COPY package*.json ./
COPY .npmrc .npmrc
RUN npm install --no-optional && npm cache clean --force
ENV PATH /app/node_modules/.bin:$PATH
COPY . .
package.json has this line:
"dependencies": {
"@myorg/myorg-common-repo": "~1.0.13",
I have tried adding these lines in a variety of places and nothing seems to work:
- RUN npm uninstall @myorg/myorg-common-repo && npm install @myorg/myorg-common-repo
- RUN npm update @myorg/myorg-common-repo --force
Any ideas on how I can get docker to build and not use the cache on @myorg/myorg-common-repo
?