My project is setup like this:
compiled files from frontend and backend directories get put here
docker build ../ --tag myImage
# The build script compiles all my assets and places
# them in the top level 'build' directory which i am
# trying to link to my docker image so I can recompile
# on each file change and have the changes show in the docker image.
docker run --volume /path/to/build/dir:/src/app myImage
RUN ls src/app
ls: cannot access src/app: No such file or directory
There is no
src/app folder in the node image, so this is an expected error. The node image expects you to add your own
/usr/src/app, either with a
COPY step in your build, or with a volume mapping after the build is finished.
The RUN gives a step to run to add a layer to the resulting built image, so an
ls makes little sense there since you didn't modify the image with new content.
The CMD gives a default command to run if one is not passed at the end of the
docker run, so if you do a
docker run node /bin/bash, the
ls src/app CMD will never be run. This also runs after other steps in your build, and after any volume mounts you may be running on your container, which would create this folder.