Created
December 22, 2014 03:37
-
-
Save ds0nt/d22dbc2bd051a629b097 to your computer and use it in GitHub Desktop.
metamaps dockerfile
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
# Dockerfile for MetaMaps | |
FROM ruby:2.1.5 | |
MAINTAINER Daniel Sont "[email protected]" | |
# nokogiri+vagrant broken dependency issues | |
ENV NOKOGIRI_USE_SYSTEM_LIBRARIES 1 | |
RUN apt-get install libxml2 libxml2-dev libxslt1-dev -y | |
# ExecJS dependency on nodejs | |
RUN curl -sL https://deb.nodesource.com/setup | bash - | |
RUN apt-get update -q && \ | |
apt-get install -qy nodejs --no-install-recommends && \ | |
apt-get clean && \ | |
cd /var/lib/apt/lists && rm -fr *Release* *Sources* *Packages* && \ | |
truncate -s 0 /var/log/*log | |
# libpq-dev libqt4-dev xvfb nodejs imagemagick | |
RUN mkdir -p /usr/src/app | |
RUN mkdir /gems | |
VOLUME /gems | |
EXPOSE 3000 | |
# throw errors if Gemfile has been modified since Gemfile.lock | |
# RUN bundle config --global frozen 1 | |
# Install Deps when Gemfile Changes | |
# COPY src/Gemfile /usr/src/app/ | |
# COPY src/Gemfile.lock /usr/src/app/ | |
COPY dev-startup.sh /usr/src/dev-startup.sh | |
COPY database-docker.yml /usr/src/app/config/database.yml | |
COPY src /usr/src/app | |
WORKDIR /usr/src | |
CMD /bin/bash -c "./dev-startup.sh" |
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
#!/bin/bash | |
# run from inside the container when it runs | |
cd app | |
bundle install --path /gems | |
rake db:create | |
rake db:schema:load | |
rake db:fixtures:load | |
rails s |
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
#!/bin/bash | |
# Rough script to restart dockers | |
cmd=$1 | |
fail () { | |
echo "$@"; | |
exit 1; | |
} | |
if [ ! -d src ]; then | |
fail "./src directory is missing" | |
fi | |
if [[ "$cmd" == "build" ]]; then | |
echo "Building Metamaps Docker Image" | |
docker build -t metamaps . || fail "Failed To Build Metamaps" | |
fi | |
metamaps () { | |
docker stop metamaps | |
docker rm metamaps | |
docker run \ | |
-v $(pwd)/gems:/gems \ | |
--link postgres:postgres \ | |
--name metamaps metamaps | |
} | |
if [[ "$cmd" == "run" ]]; then | |
# if [[ ! $(docker ps | grep postgres) ]]; then | |
docker stop postgres | |
docker rm postgres | |
docker run -d -v $(pwd)/data:/data --name=postgres postgres | |
# else | |
# fi | |
metamaps | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment