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 Ah, okay. I am developing a Next.js app, and its dependency installation is quite annoying. Without such a "trick", when I change something in package.json, it takes over 150 + seconds just for the yarn install step when a rebuild the Docker Image. So, any trick/optimization technique would be greatly appreciated!