From bdec532eca53b2b9b2815f39ace6b9d55ff1fded Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20=27rysiek=27=20Wo=C5=BAniak?=
 <rysiek@hackerspace.pl>
Date: Mon, 12 Dec 2016 02:10:19 +0100
Subject: [PATCH] support for DISCOURSE_ADDITIONAL_GEMS: we need to add the
 gem(s) to Gemfile and then run bundler

---
 Dockerfile | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 9b3c6b0..18c83c5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -44,19 +44,24 @@ RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash - \
 
 RUN git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git . \
  && git remote set-branches --add origin tests-passed \
- && bundle config build.nokogiri --use-system-libraries \
- && bundle install --deployment --without test --without development
+ && bundle config build.nokogiri --use-system-libraries
 
 # install additional gems
 # 
 # this expects a space-separated list of gem names
 ARG DISCOURSE_ADDITIONAL_GEMS=
 RUN if [ "$DISCOURSE_ADDITIONAL_GEMS" != "" ]; then \
+        echo >> Gemfile \
+        echo '### DISCOURSE_ADDITIONAL_GEMS' >> Gemfile \
         for GEM_NAME in $DISCOURSE_ADDITIONAL_GEMS; do \
-            bundle exec gem install "$GEM_NAME"; \
+            # add the gem to the Gemfile
+            echo "gem \"$GEM_NAME\"" >> Gemfile; \
         done; \
     fi
 
+# run bundler
+RUN bundle install --deployment --without test --without development
+    
 # install discourse plugins
 # assumptions: no spaces in URLs (urlencoding is a thing)
 # 
-- 
GitLab