diff --git a/Dockerfile b/Dockerfile
index d7a6648d78716cb85f29a85ad837a1de69f0b64f..9b3c6b07ba979ba9e1db829ef5c6337b18763fe7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -47,6 +47,15 @@ RUN git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discou
  && bundle config build.nokogiri --use-system-libraries \
  && bundle install --deployment --without test --without development
 
+# install additional gems
+# 
+# this expects a space-separated list of gem names
+ARG DISCOURSE_ADDITIONAL_GEMS=
+RUN if [ "$DISCOURSE_ADDITIONAL_GEMS" != "" ]; then \
+        for GEM_NAME in $DISCOURSE_ADDITIONAL_GEMS; do \
+            bundle exec gem install "$GEM_NAME"; \
+        done; \
+    fi
 
 # install discourse plugins
 # assumptions: no spaces in URLs (urlencoding is a thing)