An yarn cache compatible Dockerfile, for building node.js images faster.
Clone this gist into your project root, and add it to your source control.
Change the image service-name:latest tag to your project name in the Dockerfile and build.sh files.
Then, always build your image using the build.sh script.
$ chmod +x ./build.sh
$ ./build.sh
Here is a setup I configured without the need for a local
build.shscript to build your image. This will not build node dependencies in to the image, but instead preserve them on a mounted volume:docker-compose.ymlDockerfiledocker-entrypoint.sh