-
Notifications
You must be signed in to change notification settings - Fork 324
Description
NOTE: this issue predates this project's rename to Volta.
We love the idea of Notion (and nvm) as it makes it easier to persist a shared version of Node.js throughout many environments (local, Travis, production [Docker]). However, there's a limitation in Notion that we didn't have with nvm, and that comes from locking node/yarn within package.json itself.
This limitation realistically only comes up when you're doing layer caching, which if you're not familiar with I'm probably not a good person to learn from, but here we go:
We try to install Node and capture it outside of package.json because it means we dont have to rebuild the Node.js layer every time packages change. Dockerfile looks something like:
COPY .nvmrc /usr/src/zeus/
ENV YARN_VERSION 1.7.0
RUN set -x \
&& export NODE_VERSION=$(cat /usr/src/zeus/.nvmrc) \
[...]
Now this worked actually extremely well. We had a single file we could pull/parse to get the node version everywhere.
When moving to Notion our only real alternative is passing a Docker build arg:
--build-arg NODE_VERSION=$(shell bin/get-node-version | tr -d '\n') \
This is fine and all, but tools like Google's Cloud Build (cloudbuild.yaml) doesn't let you do dynamic arguments like this. That means we're stuck with either rebuilding the Node.js layer every time package.json changes, or hardcoding NODE_VERSION elsewhere.
I'm not proposing a solution here, but wanted to make sure everyones aware of this problem as its a shortcoming with a lot of package management tooling.