Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using Docker containers to run my CRA application. I use 2 different DockerFile, one for running CRA in development and one to generate the build. During the step of installing dependencies:

FROM node:15.5.0-alpine3.10

USER node

RUN mkdir /home/node/code
WORKDIR /home/node/code

COPY package.json yarn.lock ./
RUN yarn

ENV PATH /home/node/code/node_modules/.bin:$PATH

CMD yarn start

I need to copy my updated yarn.lock file (or package-lock.json file is using NPM) back to host after the container generate the new version of the file.

I had search the solution everywhere, but I didn't find anything to resolve this problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
4.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

docker cp, for example docker cp [running container id]:/home/node/code/yarn.lock yarn.lock. You can also use volumes rather than copying things in and out.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...