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
@etgrieco The provided code works. On the initial container start up the dependencies need to be downloaded and then are stored into the volume. When the container it is stoped and started again, dependencies does not need to re-installed but yarn take some time to "Link the dependencies", and this happens on every container restart. Any idea about that ? It take a good amount of time in my end (~20 seconds to link the dependencies).