Skip to content

Instantly share code, notes, and snippets.

@branning
Created June 18, 2015 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save branning/0cda129067f00d8e6d24 to your computer and use it in GitHub Desktop.
Save branning/0cda129067f00d8e6d24 to your computer and use it in GitHub Desktop.
bootstrap a new Rails app in Docker from boot2docker
#!/bin/sh
# comment by @mazzolino https://registry.hub.docker.com/_/rails/
# switch to pinned version of Rails, latest was broken
USAGE="Usage: $0 <your app name>"
TAG="4.2"
if [ "$#" -eq 0 ]; then
echo "$USAGE"
exit 1
fi
docker run -it -v $(pwd):/usr/src/app -w /usr/src/app rails:"$TAG" rails new "$1"
#!/bin/sh
USAGE="Usage: $0 <your app name>"
if [ "$#" -eq 0 ]; then
echo "$USAGE"
exit 1
fi
cp Dockerfile "$1"
cd "$1"
docker build -t "$1" .
FROM rails:onbuild
#!/bin/sh
USAGE="Usage: $0 <your app name>"
if [ "$#" -eq 0 ]; then
echo "$USAGE"
exit 1
fi
docker exec -it "$1"-container /bin/bash
#!/bin/sh
USAGE="Usage: $0 <your app name>"
if [ "$#" -eq 0 ]; then
echo "$USAGE"
exit 1
fi
docker run --name "$1"-container -p 8080:3000 -v $(pwd):/usr/src/app -w /usr/src/app -d "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment