# NAME: discourse/base
-# VERSION: 1.3.8
+# VERSION: release
FROM ubuntu:16.04
ENV PG_MAJOR 9.5
-ENV CONFIGURE_OPTS --with-jemalloc
+ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1
+ENV COMPRESS_BROTLI 1
MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
postgresql-${PG_MAJOR} postgresql-client-${PG_MAJOR} \
postgresql-contrib-${PG_MAJOR} libpq-dev libreadline-dev \
language-pack-en cron anacron \
- psmisc rsyslog vim whois brotli
+ psmisc rsyslog vim whois brotli libunwind-dev
RUN sed -i -e 's/start -q anacron/anacron -s/' /etc/cron.d/anacron
RUN sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf
RUN dpkg-divert --local --rename --add /sbin/initctl
rm -f /etc/apt/apt.conf.d/40proxy &&\
locale-gen en_US &&\
apt-get install -y nodejs &&\
- npm install uglify-js -g &&\
+ npm install -g uglify-js@"<3" &&\
npm install svgo -g
ADD install-nginx /tmp/install-nginx
tar -xjf jemalloc-3.6.0.tar.bz2 && cd jemalloc-3.6.0 && ./configure --prefix=/usr && make && make install &&\
cd / && rm -rf /jemalloc
+RUN mkdir /gperftools && git clone https://github.com/gperftools/gperftools.git /gperftools &&\
+ cd /gperftools && git checkout gperftools-2.5 && ./autogen.sh && ./configure --prefix=$PWD/lib &&\
+ make install && mv lib/lib/libtcmalloc_minimal.so.4.3.0 /usr/lib && cd / && rm -rf /gperftools
+
+RUN mkdir /lockless && cd /lockless && curl -O https://locklessinc.com/downloads/lockless_allocator_linux.tgz &&\
+ tar zxf lockless_allocator_linux.tgz && mv lockless_allocator_linux/64bit/libllalloc.so.1.4 /usr/lib &&\
+ cd / && rm -rf /lockless
+
RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\
cd /src/ruby-build && ./install.sh &&\
- cd / && rm -rf /src/ruby-build && ruby-build 2.3.3 /usr/local
+ cd / && rm -rf /src/ruby-build && ruby-build 2.4.1 /usr/local
RUN gem install bundler &&\
- rm -rf /usr/local/share/ri/2.3.0/system &&\
+ rm -rf /usr/local/share/ri/2.4.1/system &&\
cd / && git clone https://github.com/SamSaffron/pups.git
ADD install-imagemagick /tmp/install-imagemagick
RUN /tmp/install-imagemagick
# Validate install
-RUN ruby -e "v='`convert -version`'; ['png','tiff','jpeg','freetype'].each{ |f| ((STDERR.puts('no ' + f + ' support in imagemagick')); exit(-1)) unless v.include?(f)}"
+RUN ruby -Eutf-8 -e "v = \`convert -version\`; %w{png tiff jpeg freetype}.each { |f| unless v.include?(f); STDERR.puts('no ' + f + ' support in imagemagick'); exit(-1); end }"
-#
ADD install-pngcrush /tmp/install-pngcrush
RUN /tmp/install-pngcrush
ADD cron /etc/service/cron/run
ADD rsyslog /etc/service/rsyslog/run
ADD cron.d_anacron /etc/cron.d/anacron
+
+
+# Discourse specific bits
+RUN useradd discourse -s /bin/bash -m -U &&\
+ mkdir -p /var/www &&\
+ cd /var/www &&\
+ git clone https://github.com/discourse/discourse.git &&\
+ cd discourse &&\
+ git remote set-branches --add origin tests-passed &&\
+ chown -R discourse:discourse /var/www/discourse &&\
+ cd /var/www/discourse &&\
+ sudo -u discourse bundle install --deployment \
+ --without test --without development &&\
+ find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +