Reputation: 2709
I have Dockerfile like:
FROM node:10-alpine
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
USER node
RUN npm install
COPY --chown=node:node . .
RUN npm run build
I need compiled files on my local drive not in docker container.
VOLUME
looks like I need I think, but dunno how to do it, to make the build and share those build files.
can someone help me ? thanks!
Upvotes: 1
Views: 1211
Reputation: 2497
You can use
docker cp <containerId>:/file/path/within/container /host/path/target
Upvotes: 1
Reputation: 11999
Assuming npm run build
in your Dockerfile produces a build
directory, you can get it locally using a volume indeed
docker build -t <yourcontainername> .
docker run \
-v ${PWD}/build:/home/node/app/build \
-it <yourcontainername>
Upvotes: 2