2014-08-14 12:26:10 +00:00
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-01-02 17:34:42 +00:00
|
|
|
# Copy supervisord launch file for resin-supervisor
|
|
|
|
cp /app/resin-supervisor.conf /etc/supervisor/conf.d/resin-supervisor.conf
|
|
|
|
|
2014-08-01 15:20:58 +00:00
|
|
|
if [ $NODE_ENV == 'production' ]; then
|
2014-09-30 15:28:06 +00:00
|
|
|
chmod +x src/enterContainer.sh
|
|
|
|
|
2014-08-01 15:20:58 +00:00
|
|
|
node ./node_modules/coffee-script/bin/coffee -c ./src
|
2014-08-07 20:20:49 +00:00
|
|
|
# We don't need coffee-script at runtime
|
2014-08-01 15:20:58 +00:00
|
|
|
npm uninstall coffee-script
|
2014-08-07 20:21:53 +00:00
|
|
|
# Empty the apt and npm caches of the packages we installed
|
|
|
|
npm cache clean
|
|
|
|
apt-get clean
|
2014-08-07 20:20:49 +00:00
|
|
|
# Remove deploy key
|
|
|
|
rm -rf /root/.ssh/* deploy_key
|
|
|
|
# Remove unnecessary source files
|
|
|
|
rm -rf Makefile src/*.coffee
|
2014-08-07 20:28:15 +00:00
|
|
|
# Remove the git repo info
|
|
|
|
rm -rf .git
|
2014-08-07 20:47:36 +00:00
|
|
|
# Remove the c files we no longer need (the sqlite3 node module has a massive ~5M c file)
|
|
|
|
find . -name '*.c' -delete
|
|
|
|
# And the tar files (sqlite3 module again)
|
|
|
|
find . -name '*.tar.*' -delete
|
2014-08-07 21:23:01 +00:00
|
|
|
# Who needs tests and docs? Pffft! - Ignoring errors because find isn't a fan of us deleting directories whilst it's trying to search within them.
|
|
|
|
find . -type d -name 'test' -exec rm -rf '{}' \; 2> /dev/null || true
|
|
|
|
find . -type d -name 'doc' -exec rm -rf '{}' \; 2> /dev/null || true
|
|
|
|
find . -type d -name 'man' -exec rm -rf '{}' \; 2> /dev/null || true
|
2015-01-06 14:37:34 +00:00
|
|
|
# And any benchmark results (ttyjs->socket.io->socket.io-client->active-x-obfuscator->zeparser has an 8MB benchmark.html)
|
|
|
|
find . -type d -name 'benchmark*' -exec rm -rf '{}' \; 2> /dev/null || true
|
|
|
|
find . -name 'benchmark*' -delete
|
2015-01-07 19:27:28 +00:00
|
|
|
# And npm - we've finished with it
|
|
|
|
find . -type d -name 'npm' -exec rm -rf '{}' \; 2> /dev/null || true
|
2014-08-01 15:20:58 +00:00
|
|
|
fi
|