Open droidscout opened 4 years ago
Code snippet from 12/s2i/bin/assemble:
if [ "$NODE_ENV" != "production" ]; then
echo "---> Building your Node application from source"
npm install
else
echo "---> Installing all dependencies"
NODE_ENV=development npm install
#do not fail when there is no build script
echo "---> Building in production mode"
npm run build --if-present
echo "---> Pruning the development dependencies"
npm prune
# Clear the npm's cache and tmp directories only if they are not a docker volumes
NPM_CACHE=$(npm config get cache)
if ! mountpoint $NPM_CACHE; then
echo "---> Cleaning the npm cache $NPM_CACHE"
#As of npm@5 even the 'npm cache clean --force' does not fully remove the cache directory
# instead of $NPM_CACHE* use $NPM_CACHE/*.
# We do not want to delete .npmrc file.
rm -rf "${NPM_CACHE:?}/"
fi
NPM_TMP=$(npm config get tmp)
if ! mountpoint $NPM_TMP; then
echo "---> Cleaning the $NPM_TMP/npm-*"
rm -rf $NPM_TMP/npm-*
fi
fi
fix-permissions ./
This definitely looks like a bug to me: https://github.com/sclorg/s2i-nodejs-container/blob/master/14/s2i/bin/assemble#L89
if [ "$NODE_ENV" != "production" ]; then
your NODE_ENV settings end up getting overwritten with "development"
@ryanj exactly. I also found it. I guess it's kind of a hack to install both dependencies and dev dependencies.
Hi there!
I've noticed that setting the NODE_ENV variable to something other than "production" doesn't takes the nodejs runtime mode into account.
My package.json has the following scripts added: "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "production": "ng build --configuration=production", "integration": "ng build --configuration=integration", "development": "ng build --configuration=dev", "run_dev": "ng serve --configuration=dev" }
When passing either NODE_ENV=integration or event NODE_ENV=development it just downloads the package dependencies but never builds the source.
Is this an intended use case for the sources not being built? If that's the case, then s2i build would only create a container with the source code and it's dependencies.
Stay safe and all the best, Ralph