From 5db6d4ac091c4b7a56760181174e886a70c53c45 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Wed, 31 Aug 2016 09:58:50 -0700 Subject: [PATCH 01/13] 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 02/13] 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 03/13] 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 04/13] 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 05/13] 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 From 0d5976d70f6f4c18ab485ec2c82a94cf8cdd4bf7 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Tue, 4 Oct 2016 00:07:41 -0700 Subject: [PATCH 06/13] New Debian based image Debian build now working. Includes phantomjs --- Dockerfile | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7aea98b..66f3dd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,23 @@ -FROM ruby:2.3-alpine +FROM ruby:2.3 -# 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 \ - grep \ - libxml2 \ - linux-headers \ - mariadb-dev \ - mariadb-client \ +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ nodejs \ - ruby-dev \ - tzdata \ - wget \ - && rm -rf /var/cache/apk/* \ - && update-ca-certificates + git \ + build-essential \ + chrpath \ + libssl-dev \ + libxft-dev \ + libfontconfig1 \ + libfontconfig1-dev -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 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} && \ From 1999ccec0db4a178b22d4d8a2bd1415b8c8ef2fb Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Tue, 11 Oct 2016 13:45:07 -0700 Subject: [PATCH 07/13] Adding mysql-client package --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 66f3dd2..80a024a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,8 @@ RUN apt-get update && \ libssl-dev \ libxft-dev \ libfontconfig1 \ - libfontconfig1-dev + libfontconfig1-dev \ + mysql-client ARG PHANTOM_FILE=phantomjs-2.1.1-linux-x86_64 RUN wget https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOM_FILE}.tar.bz2 From 075fe509cf2a988233497f004461787e160b3e6d Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Mon, 24 Oct 2016 16:59:22 -0700 Subject: [PATCH 08/13] Adding node.js to image --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 80a024a..ddad86e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,10 @@ RUN wget -q http://geolite.maxmind.com/download/geoip/database/${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 + ENV APP=/iqapp ENV DOCKER=true RUN mkdir -p $APP From d4440054057577f23f735c22bd2b77e63980ad3e Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Wed, 30 Nov 2016 13:44:28 -0800 Subject: [PATCH 09/13] Adding logrotate for rails logs and vim and less packages --- Dockerfile | 14 +++++++++----- build.sh | 4 ++-- files/logrotate | 8 ++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 files/logrotate diff --git a/Dockerfile b/Dockerfile index ddad86e..236c9ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,15 +3,17 @@ FROM ruby:2.3 RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ - nodejs \ - git \ build-essential \ chrpath \ - libssl-dev \ - libxft-dev \ + git \ + less \ libfontconfig1 \ libfontconfig1-dev \ - mysql-client + libssl-dev \ + libxft-dev \ + mysql-client \ + nodejs \ + vim-tiny ARG PHANTOM_FILE=phantomjs-2.1.1-linux-x86_64 RUN wget https://bitbucket.org/ariya/phantomjs/downloads/${PHANTOM_FILE}.tar.bz2 @@ -30,6 +32,8 @@ RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ apt-get install nodejs && \ apt-get autoremove -y +COPY files/logrotate /etc/logrotate.d/rails + ENV APP=/iqapp ENV DOCKER=true RUN mkdir -p $APP diff --git a/build.sh b/build.sh index 769ab86..7728f7e 100755 --- a/build.sh +++ b/build.sh @@ -3,8 +3,8 @@ BUILDFLAGS="$@" echo "Building rails image" -IMAGE="inquicker/rails-dev:latest" -# IMAGE="mrinterweb/iq-rails:latest" +# 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..58095e5 --- /dev/null +++ b/files/logrotate @@ -0,0 +1,8 @@ +/iqapp/log/*.log { + daily + rotate 0 + size 100M + missingok + notifempty + create 644 1000 root +} From bc61da971af1e225a29e2b5a98c50a840c3c1b32 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Wed, 30 Nov 2016 13:47:23 -0800 Subject: [PATCH 10/13] fixing logrotate spacing --- files/logrotate | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/logrotate b/files/logrotate index 58095e5..d3c76ed 100644 --- a/files/logrotate +++ b/files/logrotate @@ -1,8 +1,8 @@ /iqapp/log/*.log { - daily - rotate 0 + daily + rotate 0 size 100M - missingok - notifempty - create 644 1000 root + missingok + notifempty + create 644 1000 root } From 61bd64e66ad5d70e0ef8da0f234db465e0853bbf Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Wed, 14 Dec 2016 11:16:43 -0800 Subject: [PATCH 11/13] Adding bower to Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 236c9ed..0e3d008 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,9 @@ 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 + COPY files/logrotate /etc/logrotate.d/rails ENV APP=/iqapp From 59d4398ce8d73fe36857430a4ada0c3ef81d59d6 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Tue, 3 Jan 2017 11:24:42 -0800 Subject: [PATCH 12/13] Adding aglio npm package --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0e3d008..f0e97c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,6 @@ RUN apt-get update && \ libssl-dev \ libxft-dev \ mysql-client \ - nodejs \ vim-tiny ARG PHANTOM_FILE=phantomjs-2.1.1-linux-x86_64 @@ -34,6 +33,7 @@ RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \ RUN npm install -g bower && \ echo '{ "allow_root": true }' > /root/.bowerrc +RUN npm install -g aglio COPY files/logrotate /etc/logrotate.d/rails From df4eed97ec9aa9bf1693806f32e5973b9145f85f Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Tue, 20 Jun 2017 16:51:45 -0700 Subject: [PATCH 13/13] Bumping bundler version to force image rebuild --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f0e97c8..810d627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,4 +48,4 @@ ENV BUNDLE_GEMFILE=${APP}/Gemfile \ BUNDLE_JOBS=8 \ BUNDLE_PATH=/bundle -RUN gem install bundler +RUN gem install bundler -v 1.15.1