reactioncommerce / docker-base

Apache License 2.0
4 stars 11 forks source link

Entrypoint requires a specific mount path #23

Closed rosshadden closed 4 years ago

rosshadden commented 4 years ago

The entrypoint script in the 12.14 base image requires the app to be mounted at /usr/local/src/app, and only runs npm install if this is the case.

The earlier images all ran npm install no matter what the mount path was, but after investigating why it turns out it was likely an unexpected bug. This is the relevant code from the earlier images:

if [[ -f /usr/local/src/app/yarn.lock ]]; then
  echo "(Using Yarn because there is a yarn.lock file)"
  su-exec node yarn install
else
  su-exec node npm install --no-audit
fi

It's looking for yarn.lock in the required mount path, and if not found it runs npm install regardless of where the mount path is. Based on this code it seems the expectation was to only install npm dependencies at the one mount path as well, but some of our other projects were relying on this. Thus when it was "fixed" we had regressions. https://xkcd.com/1172/

Ultimately the entrypoint script should not care where you mount your application. We should make it mount-agnostic.