[discourse-web/gnome] Parametrize Dockerfile



commit 3081b8cefcc9b5ea3339b02d5070d0f1f997f0db
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Apr 5 17:13:01 2022 +0200

    Parametrize Dockerfile

 Dockerfile | 58 ++++++++++++++++++++++------------------------------------
 1 file changed, 22 insertions(+), 36 deletions(-)
---
diff --git a/Dockerfile b/Dockerfile
index 629bb37..b6767d2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,47 +1,30 @@
-# Check https://github.com/discourse/discourse_docker/blob/master/launcher
-FROM discourse/base:2.0.20201221-2020
-
-LABEL maintainer="Discourse Administrators <discourse-admins cern ch>" \
-      io.openshift.expose-services="8080,3000,6379:http"
+ARG BASE_IMAGE_TAG
+FROM discourse/base:$BASE_IMAGE_TAG
 
 ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1
 ENV RAILS_ENV production
 ENV DEBIAN_FRONTEND noninteractive 
 
-# Use gettext for envsubst
+# Install gettext for envsubst
 RUN apt-get update && \
-    apt-get install -y gettext
-RUN apt clean
-
-### Configure Nginx
-### n.b.: https://www.redpill-linpro.com/sysadvent/2017/12/10/jekyll-openshift.html
-### /var/run is configured for different pids. Check unicorn.conf.rb and sidekiq.yml configurations.
-RUN \
-  ln -sf /dev/stdout /var/log/nginx/access.log && \
-  ln -sf /dev/stderr /var/log/nginx/error.log && \
-  mkdir -p /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx && \
-  chgrp -R 0 /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx && \
-  chmod -R g=u /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx
-
-### Discourse specific bits
+    apt-get install -y gettext && \
+    apt clean
 
-# Install modified version of Discourse
-# we can override it with --build_arg
-ARG DISCOURSE_VERS='stable'
-ENV DISCOURSE_RELEASE=$DISCOURSE_VERS RAILS_ROOT=/discourse HOME=/discourse
+RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
+    ln -sf /dev/stderr /var/log/nginx/error.log && \
+    mkdir -p /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx && \
+    chgrp -R 0 /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx && \
+    chmod -R g=u /etc/nginx/ /var/run /var/cache/nginx /var/lib/nginx /var/log/nginx
 
-# Remove upstream discourse installation, so we will pre-cook ours.
+ENV DISCOURSE_RELEASE=stable RAILS_ROOT=/discourse HOME=/discourse
 RUN rm -rf /var/www/discourse && \
     mkdir -p discourse && \
     git clone --single-branch --branch "$DISCOURSE_RELEASE"  https://github.com/discourse/discourse.git 
/discourse    
 
-### Discourse config
 ADD config/unicorn.conf.rb /discourse/config/unicorn.conf.rb
-# Go to /tmp to be ready for envsubst
 ADD config/discourse.conf /tmp/discourse-configmap/discourse.conf
 ADD config/sidekiq.yml /tmp/discourse-configmap/sidekiq.yml
 
-# Nginx config
 ADD config/nginx.conf /etc/nginx/nginx.conf
 ADD config/discourse-nginx.conf /etc/nginx/conf.d/nginx.conf
 
@@ -52,19 +35,22 @@ ADD config/policy.xml /usr/local/etc/ImageMagick-7/
 WORKDIR $HOME
 
 ### Plugins
-RUN \
-    git clone --depth=1 https://github.com/jonmbake/discourse-ldap-auth 
/discourse/plugins/discourse-ldap-auth && \
-    git clone --depth=1 https://github.com/discourse/discourse-oauth2-basic.git 
/discourse/plugins/discourse-oauth2-basic && \
-    git clone --depth=1 https://github.com/discourse/discourse-solved.git 
/discourse/plugins/discourse-solved && \
-    git clone --depth=1 https://github.com/discourse/discourse-saved-searches.git 
/discourse/plugins/discourse-saved-searches && \
-    git clone --depth=1 https://github.com/discourse/discourse-voting.git /discourse/plugins/discourse-voting
+RUN cd /discourse/plugins/ \
+    git clone --depth=1 https://github.com/jonmbake/discourse-ldap-auth && \
+    git clone --depth=1 https://github.com/discourse/discourse-oauth2-basic && \
+    git clone --depth=1 https://github.com/discourse/discourse-solved && \
+    git clone --depth=1 https://github.com/discourse/discourse-saved-searches.git && \
+    git clone --depth=1 https://github.com/discourse/discourse-voting.git
 
 ### Gem installation
-RUN exec bundle install --deployment --jobs 4 --without test --without development && \
+RUN bundle config --local deployment true && \
+    bundle config --local path ./vendor/bundle && \
+    bundle config --local without test development && \
+    bundle install --jobs 4 && \
     exec bundle exec rake maxminddb:get && \
     find /discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
 
-COPY ["cgroup-limits","init-dbmigration.sh","run-discourse.sh","run-nginx.sh","./"]
+COPY cgroup-limits init-dbmigration.sh run-discourse.sh run-nginx.sh .
 RUN chmod +x ./run-discourse.sh ./run-nginx.sh ./init-dbmigration.sh && \
     chgrp -R 0 /discourse && chmod -R g=u /discourse && \
     chmod +x /discourse/config/unicorn_launcher


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]