diff --git a/Dockerfile b/Dockerfile index 94fe584..810d627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,51 @@ -FROM rails:4.2.5 - -RUN \ - curl -LOs https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 && \ - tar xjf phantomjs-1.9.8-linux-x86_64.tar.bz2 && \ - cp phantomjs-1.9.8-linux-x86_64/bin/phantomjs /usr/local/bin/ && \ - rm -r phantomjs-1.9.8-linux-x86_64 phantomjs-1.9.8-linux-x86_64.tar.bz2 && \ - curl -LOs http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && \ - gunzip GeoLiteCity.dat.gz && \ +FROM ruby:2.3 + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + build-essential \ + chrpath \ + git \ + less \ + libfontconfig1 \ + libfontconfig1-dev \ + libssl-dev \ + libxft-dev \ + mysql-client \ + vim-tiny + +ARG PHANTOM_FILE=phantomjs-2.1.1-linux-x86_64 +RUN wget https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOM_FILE}.tar.bz2 +RUN tar -xvjf ${PHANTOM_FILE}.tar.bz2 && \ + mv ${PHANTOM_FILE} /usr/local/share && \ + rm ${PHANTOM_FILE}.tar.bz2 && \ + ln -sf /usr/local/share/${PHANTOM_FILE}/bin/phantomjs /usr/local/bin + +ARG geolite_file=GeoLiteCity.dat.gz +RUN wget -q http://geolite.maxmind.com/download/geoip/database/${geolite_file} && \ + gunzip ${geolite_file} && \ mkdir -p /usr/share/GeoIP/ && \ mv GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat + +RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ + apt-get install nodejs && \ + apt-get autoremove -y + +RUN npm install -g bower && \ + echo '{ "allow_root": true }' > /root/.bowerrc +RUN npm install -g aglio + +COPY files/logrotate /etc/logrotate.d/rails + +ENV APP=/iqapp +ENV DOCKER=true +RUN mkdir -p $APP +# Need to set /iqapp to read write so the sync tool can work +RUN chmod a+rw $APP +WORKDIR $APP + +ENV BUNDLE_GEMFILE=${APP}/Gemfile \ + BUNDLE_JOBS=8 \ + BUNDLE_PATH=/bundle + +RUN gem install bundler -v 1.15.1 diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..7728f7e --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +BUILDFLAGS="$@" + +echo "Building rails image" +# IMAGE="inquicker/rails-dev:latest" +IMAGE="mrinterweb/iq-rails:latest" + +docker build $BUILDFLAGS -t $IMAGE . +docker push $IMAGE + diff --git a/files/logrotate b/files/logrotate new file mode 100644 index 0000000..d3c76ed --- /dev/null +++ b/files/logrotate @@ -0,0 +1,8 @@ +/iqapp/log/*.log { + daily + rotate 0 + size 100M + missingok + notifempty + create 644 1000 root +}