Add a "compact" script to the buildpack to reduce final image size. Realized that webpack was always required even though it's a devDep; made it so that it doesn't have to be loaded.

This commit is contained in:
Simo Kinnunen
2014-07-30 17:53:33 +09:00
parent 93973dc953
commit 905a81fff8
3 changed files with 49 additions and 3 deletions

19
buildpack/bin/compact Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e # fail fast
set -o pipefail # don't ignore exit codes when piping output
# set -x # enable debugging
bp_dir=$(cd $(dirname $0); cd ..; pwd)
# Load some convenience functions like status()
source $bp_dir/bin/common.sh
for pack in node bower gulp; do
if name=$($bp_dir/buildpacks/$pack/bin/detect "$@"); then
if test -f $bp_dir/buildpacks/$pack/bin/compact; then
status "Compacting ${name}"
$bp_dir/buildpacks/$pack/bin/compact "$@"
fi
fi
done