From 5db6d4ac091c4b7a56760181174e886a70c53c45 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Wed, 31 Aug 2016 09:58:50 -0700 Subject: [PATCH 1/5] revised Dockerfile and added build.sh --- Dockerfile | 55 ++++++++++++++++++++++++++++++++++++++++++++++-------- build.sh | 8 ++++++++ 2 files changed, 55 insertions(+), 8 deletions(-) create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile index 94fe584..a543f7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,50 @@ -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 && \ +FROM ruby:2.3-alpine + +RUN apk add --no-cache \ + build-base \ + postgresql-dev \ + git \ + bash \ + nodejs \ + libxml2-dev libxslt-dev \ + linux-headers \ + && rm -rf /var/cache/apk/* + +RUN curl -Ls https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 \ + | tar xjC / + + # zcat phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar -xzf - && \ + # 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 + +RUN curl -LOs http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && \ gunzip GeoLiteCity.dat.gz && \ mkdir -p /usr/share/GeoIP/ && \ mv GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat + +ENV APP=/app +ENV DOCKER=true +RUN mkdir -p $APP +WORKDIR $APP + +ENV BUNDLE_GEMFILE=/app/Gemfile \ + BUNDLE_JOBS=8 \ + BUNDLE_PATH=/bundle + + +RUN gem install bundler \ + && bundle config build.nokogiri --use-system-libraries + +# COPY Gemfile Gemfile.lock ./ +# RUN bundle install \ + # && echo "Bundle install complete" + +# RUN RAILS_ENV=production bundle install --without development test --no-color --path /opt/app +# COPY . $APP + +ENV PORT=3000 + +EXPOSE $PORT + +ENTRYPOINT ["bundle", "exec"] +CMD ["rails", "server", "-b", "0.0.0.0"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..030878f --- /dev/null +++ b/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +BUILDFLAGS="$@" + +echo "Building rails image" +docker build $BUILDFLAGS -t "inquicker/rails-dev:latest" . + +# docker push inquicker/rails-dev:latest From a3b6e7868f28a35fb16c212a8e96b29f14cd8fd6 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Thu, 29 Sep 2016 10:01:03 -0700 Subject: [PATCH 2/5] Working Alpine linux image --- Dockerfile | 71 +++++++++++++++++++++++++++--------------------------- build.sh | 3 ++- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index a543f7f..45f297d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,51 @@ FROM ruby:2.3-alpine -RUN apk add --no-cache \ - build-base \ - postgresql-dev \ - git \ - bash \ - nodejs \ - libxml2-dev libxslt-dev \ - linux-headers \ - && rm -rf /var/cache/apk/* - -RUN curl -Ls https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 \ - | tar xjC / - - # zcat phantomjs-1.9.8-linux-x86_64.tar.bz2 | tar -xzf - && \ - # 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 - -RUN curl -LOs http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && \ - gunzip GeoLiteCity.dat.gz && \ +# mariadb-dev is a big package (226MB). It is required to compile mysql2 gem + +RUN apk update && \ + apk upgrade && \ + apk add --no-cache \ + bash \ + build-base \ + ca-certificates \ + curl \ + curl-dev \ + geoip-dev \ + git \ + libxml2 \ + linux-headers \ + mariadb-dev \ + mariadb-client \ + nodejs \ + ruby-dev \ + tzdata \ + wget \ + && rm -rf /var/cache/apk/* \ + && update-ca-certificates + +ARG phantom_file=phantomjs-2.1.1-linux-x86_64 +RUN wget -q https://bitbucket.org/ariya/phantomjs/downloads/${phantom_file}.tar.bz2 && \ + tar -xjf ${phantom_file}.tar.bz2 && \ + cp $phantom_file/bin/phantomjs /usr/local/bin && \ + rm -rf ${phantom_file} ${phantom_file}.tar.bz2 + +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 -ENV APP=/app +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 \ +ENV BUNDLE_GEMFILE=${APP}/Gemfile \ BUNDLE_JOBS=8 \ BUNDLE_PATH=/bundle - RUN gem install bundler \ && bundle config build.nokogiri --use-system-libraries -# COPY Gemfile Gemfile.lock ./ -# RUN bundle install \ - # && echo "Bundle install complete" - -# RUN RAILS_ENV=production bundle install --without development test --no-color --path /opt/app -# COPY . $APP - -ENV PORT=3000 - -EXPOSE $PORT - -ENTRYPOINT ["bundle", "exec"] -CMD ["rails", "server", "-b", "0.0.0.0"] diff --git a/build.sh b/build.sh index 030878f..4097158 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,7 @@ BUILDFLAGS="$@" echo "Building rails image" -docker build $BUILDFLAGS -t "inquicker/rails-dev:latest" . +# docker build $BUILDFLAGS -t "inquicker/rails-dev:latest" . +docker build $BUILDFLAGS -t "mrinterweb/iq-rails:latest" . # docker push inquicker/rails-dev:latest From 5a3290f9dbfa8d4f2cb395fc1801054b4057dddf Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Thu, 29 Sep 2016 14:08:21 -0700 Subject: [PATCH 3/5] Pointing build.sh back to inquicker/rails-dev --- build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 4097158..769ab86 100755 --- a/build.sh +++ b/build.sh @@ -3,7 +3,9 @@ BUILDFLAGS="$@" echo "Building rails image" -# docker build $BUILDFLAGS -t "inquicker/rails-dev:latest" . -docker build $BUILDFLAGS -t "mrinterweb/iq-rails:latest" . +IMAGE="inquicker/rails-dev:latest" +# IMAGE="mrinterweb/iq-rails:latest" + +docker build $BUILDFLAGS -t $IMAGE . +docker push $IMAGE -# docker push inquicker/rails-dev:latest From 5128f54db07be85bd27d6c13c040dd7ae5d20eb3 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Mon, 3 Oct 2016 15:20:29 -0700 Subject: [PATCH 4/5] Adding grep package to image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 45f297d..0c11f9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN apk update && \ curl-dev \ geoip-dev \ git \ + grep \ libxml2 \ linux-headers \ mariadb-dev \ From 1d09fe4f1728cc48b4133408db6611ce7e3f6230 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Mon, 3 Oct 2016 15:21:00 -0700 Subject: [PATCH 5/5] Removing special bundler config for nokogiri --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0c11f9e..7aea98b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,4 @@ ENV BUNDLE_GEMFILE=${APP}/Gemfile \ BUNDLE_JOBS=8 \ BUNDLE_PATH=/bundle -RUN gem install bundler \ - && bundle config build.nokogiri --use-system-libraries - +RUN gem install bundler