-# NAME: discourse_base
-# VERSION: 1.3.3
+# NAME: discourse/base
+# VERSION: 1.3.4
FROM ubuntu:16.04
MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
-RUN echo "1.3.3" > /VERSION
+RUN echo "1.3.4" > /VERSION
RUN apt-get update && apt-get install -y lsb-release sudo curl
RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections
RUN apt-get -y install software-properties-common
RUN apt-mark hold initscripts
RUN apt-get -y upgrade
-RUN add-apt-repository -y ppa:nginx/development
RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | \
tee /etc/apt/sources.list.d/postgres.list
libxml2-dev gawk parallel \
postgresql-${PG_MAJOR}=${PG_VERSION} postgresql-client-${PG_MAJOR}=${PG_VERSION} \
postgresql-contrib-${PG_MAJOR}=${PG_VERSION} libpq-dev libreadline-dev \
- nginx language-pack-en cron anacron \
- psmisc rsyslog vim whois
+ language-pack-en cron anacron \
+ psmisc rsyslog vim whois brotli
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
apt-get install -y nodejs &&\
npm install uglify-js -g &&\
npm install svgo -g
+
+ADD install-nginx /tmp/install-nginx
+RUN /tmp/install-nginx
+
RUN apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng
ADD install-pngquant /tmp/install-pngquant
RUN /tmp/install-pngquant
-RUN cd tmp && wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
-RUN cd tmp && tar jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
+ADD phantomjs /usr/local/bin/phantomjs
+
+# Not using the official repo until they compile against a recent openssl
+# RUN cd tmp && wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
+# RUN cd tmp && tar jxf phantomjs-2.1.1-linux-x86_64.tar.bz2 && mv /tmp/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
# clean up for docker squash
RUN rm -fr /usr/share/man &&\
--- /dev/null
+#!/bin/bash
+set -e
+VERSION=1.10.1
+cd /tmp
+
+apt-get install -y autoconf
+
+
+git clone https://github.com/bagder/libbrotli
+cd libbrotli
+./autogen.sh
+./configure
+make install
+
+cd /tmp
+
+
+# this is the reason we are compiling by hand...
+git clone https://github.com/google/ngx_brotli.git
+
+curl -O https://nginx.org/download/nginx-$VERSION.tar.gz
+tar zxf nginx-$VERSION.tar.gz
+cd nginx-$VERSION
+
+# so we get nginx user and so on
+apt-get install -y nginx libpcre3 libpcre3-dev
+# we don't want to accidentally upgrade nginx and undo our work
+apt-mark hold nginx
+
+./configure --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_v2_module --with-http_sub_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=/tmp/ngx_brotli
+
+make install
+cd /
+rm -fr /tmp/nginx
+rm -fr /tmp/libbrotli
+rm -fr /tmp/ngx_brotli
run("docker save #{img} | ./docker-squash -t #{tag} -verbose #{is_base && "-from root"} | docker load")
end
+run "(cd base && ./download_phantomjs)"
+
build("base",$base_image,true)
build("discourse",$image,false)
build("discourse_test",$test,false)