Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configure yarn request output env variables
Several yarn settings must be supplied by the cachi2 request output in order for the user to make use of the prefetched dependencies. These will be supplied by way of environment variables, which when sourced, will override any preexisting user configuration in .yarnrc.yml These yarn settings are all related to the process of installing cachi2-fetched dependencies from the globalFolder. Cachi2 must populate globalFolder for the build rather than cacheFolder because when mounting globalFolder, the `yarn install` step in the Containerfile will copy everything from the global cache to the project-local cache. That means the project-local cache stays populated after the build. When mounting cacheFolder, `yarn install` doesn't do anything (the cache is already populated). But when the build ends, podman unmounts the folder and the cache disappears. When you try to run the app: Error: Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first. YARN_GLOBAL_FOLDER must be configured to the deps/yarn subdirectory of the cachi2 request output directory. This is the path that cachi2 will populate with the prefetched dependencies. YARN_ENABLE_MIRROR must be set to true, otherwise the user build will not make use of the global cache located at the globalFolder path that cachi2 prepopulates. YARN_ENABLE_GLOBAL_CACHE must be set to false, otherwise the user build will exclusively rely on the cachi2 populated globalFolder cache rather than copying the dependencies to cacheFolder. If the volume containing globalFolder is only mounted at build-time and the dependencies are not copied to cacheFolder, the dependencies will be missing at run-time. YARN_ENABLE_IMMUTABLE_CACHE must be set to false, otherwise the `yarn install` will fail to populate cacheFolder from the cachi2-supplied globalFolder cache. Signed-off-by: Taylor Madore <[email protected]>
- Loading branch information