This repository has been archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving the long RUN command into a shell script
Adding support for catching the command failure and restoring the permissions of the build dir so go can still Clean up the directory. 2. Adding support for pre_package hook that runs before the slug tarball is generated
- Loading branch information
1 parent
d819da7
commit 20784cc
Showing
3 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
set -x -e | ||
|
||
run_in_sandbox() { | ||
CMD=$1 | ||
bash -c "${CMD} || (chown -R go:go /app && false)" | ||
} | ||
|
||
addgroup --gid $GROUP_ID go | ||
adduser -q --disabled-password --gid $GROUP_ID --uid $USER_ID --gecos \"\" --shell /bin/bash --home /var/go go | ||
run_in_sandbox "/bin/herokuish buildpack build" | ||
run_in_sandbox /bin/mesos-fix | ||
|
||
# Experimental - bin/pre_package hook run before the generating the slug tarball | ||
pushd /app | ||
if [ -f bin/pre_package ]; then | ||
echo "-----> Running pre_package hook" | ||
chmod +x bin/pre_package | ||
./bin/pre_package | ||
fi | ||
popd | ||
|
||
run_in_sandbox "/bin/herokuish slug generate" | ||
run_in_sandbox "/bin/herokuish slug export > /app/app.tar.gz" | ||
chown -R go:go /app |