Skip to content

Instantly share code, notes, and snippets.

@rochacon
Created May 10, 2014 17:49
Show Gist options
  • Save rochacon/55bcbb05b3f4a49a14bd to your computer and use it in GitHub Desktop.
Save rochacon/55bcbb05b3f4a49a14bd to your computer and use it in GitHub Desktop.
Simple gitreceive-next hook to build and run a slug with Flynn
#!/bin/bash
#
# Simple gitreceive-next hook to build and run a slug with Flynn
#
# This is an old script that I found sitting in my Desktop =P
#
# Last update: 2014-01-28
#
set -e
BUCKET="https://s3.amazonaws.com/<BUCKET_NAME>"
IMAGE="$BUCKET/$2.tgz"
PORT="$RANDOM"
URL="http://<HOST>:$PORT"
echo '-----> Builing image'
cat | docker run -i -a stdin -a stdout -v /tmp/app-cache:/tmp/cache:rw flynn/slugbuilder "$IMAGE"
echo '-----> Starting container'
id=$(docker run -d -i -e SLUG_URL="$IMAGE" -e PORT=8000 -p $PORT:8000 flynn/slugrunner start web)
echo "-----> $URL"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment