X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=image%2Fbase%2FDockerfile;h=3d938bc8e323752597ad6d9c664200cbdcd27fef;hb=731f9e717d45f89b5b395d8fc1159ccba4b28fff;hp=855c231f5b6fd3529ec961d70ebb0d0af163f18b;hpb=b8dfc9a75d745ea9f9ff3994708fe5002297c1b4;p=discourse_docker.git diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 855c231..3d938bc 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -1,75 +1,143 @@ -# Official repo only has a ppa for postgresql 9.3 at the moment (14/3/2014) -# When new LTS ships we can upgrade +# NAME: discourse/base +# VERSION: release +FROM ubuntu:16.04 -# NAME: discourse_base -# VERSION: 1.0.3 - -FROM ubuntu:14.04 +ENV PG_MAJOR 9.5 +ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1 +ENV COMPRESS_BROTLI 1 MAINTAINER Sam Saffron "https://twitter.com/samsaffron" -RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections &&\ - echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list &&\ - echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list &&\ - echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list &&\ - apt-get update && apt-get -y install fping &&\ - sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true" &&\ - apt-get -y install software-properties-common &&\ - apt-mark hold initscripts &&\ - apt-get -y upgrade &&\ - add-apt-repository -y ppa:rwky/redis &&\ - add-apt-repository -y ppa:nginx/stable &&\ - apt-get install -y curl && curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - &&\ - echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | \ - tee /etc/apt/sources.list.d/postgres.list &&\ - apt-get -y update &&\ - apt-get -y install build-essential git curl wget \ +ADD VERSION /VERSION + +RUN apt-get update && apt-get install -y lsb-release sudo curl +RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections +RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list +RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list +RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list +RUN apt-get update && apt-get -y install fping +RUN sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true" +RUN apt-get -y install software-properties-common +RUN apt-mark hold initscripts +RUN apt-get -y upgrade +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 +RUN curl --silent --location https://deb.nodesource.com/setup_6.x | sudo bash - +RUN apt-get -y update +RUN apt-get -y install build-essential git wget \ libxslt-dev libcurl4-openssl-dev \ libssl-dev libyaml-dev libtool \ - libxml2-dev gawk \ - pngcrush imagemagick \ - postgresql-9.3 postgresql-client-9.3 \ - postgresql-contrib-9.3 libpq-dev libreadline-dev \ - nginx language-pack-en sudo cron anacron \ - psmisc rsyslog vim &&\ - sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf &&\ - dpkg-divert --local --rename --add /sbin/initctl &&\ - sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl" &&\ - apt-get -y install redis-server haproxy openssh-server &&\ - cd / &&\ - mkdir /jemalloc && cd /jemalloc &&\ - wget http://www.canonware.com/download/jemalloc/jemalloc-3.4.1.tar.bz2 &&\ - tar -xvjf jemalloc-3.4.1.tar.bz2 && cd jemalloc-3.4.1 && ./configure && make &&\ - mv lib/libjemalloc.so.1 /usr/lib && cd / && rm -rf /jemalloc &&\ + libxml2-dev gawk parallel \ + 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 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 +RUN sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl" +RUN apt-get -y install redis-server haproxy openssh-server +RUN cd / &&\ apt-get -y install runit monit socat &&\ mkdir -p /etc/runit/1.d &&\ apt-get clean &&\ rm -f /etc/apt/apt.conf.d/40proxy &&\ locale-gen en_US &&\ - wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 &&\ - tar -xjf phantomjs-1.9.7-linux-x86_64.tar.bz2 &&\ - rm phantomjs-1.9.7-linux-x86_64.tar.bz2 &&\ - cp phantomjs-1.9.7-linux-x86_64/bin/phantomjs /bin/phantomjs &&\ - rm -fr phantomjs-1.9.7-linux-x86_64 &&\ - wget http://static.jonof.id.au/dl/kenutils/pngout-20130221-linux.tar.gz &&\ - tar -xvf pngout-20130221-linux.tar.gz &&\ - rm pngout-20130221-linux.tar.gz &&\ - cp pngout-20130221-linux/x86_64/pngout /bin/pngout &&\ - rm -rf pngout-20130221-linux + apt-get install -y nodejs &&\ + npm install -g uglify-js@"<3" &&\ + 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 + + +RUN mkdir /jemalloc && cd /jemalloc &&\ + wget https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2 &&\ + 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.0.0-p481 /usr/local &&\ - gem update --system &&\ - gem install bundler + cd / && rm -rf /src/ruby-build && ruby-build 2.4.1 /usr/local + +RUN gem install bundler &&\ + 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 -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 }" -RUN cd / && git clone https://github.com/SamSaffron/pups.git +ADD install-pngcrush /tmp/install-pngcrush +RUN /tmp/install-pngcrush + +ADD install-gifsicle /tmp/install-gifsicle +RUN /tmp/install-gifsicle + +ADD install-pngquant /tmp/install-pngquant +RUN /tmp/install-pngquant + +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 &&\ + rm -fr /usr/share/doc &&\ + rm -fr /usr/share/vim/vim74/tutor &&\ + rm -fr /usr/share/vim/vim74/doc &&\ + rm -fr /usr/share/vim/vim74/lang &&\ + rm -fr /usr/local/share/doc &&\ + rm -fr /usr/local/share/ruby-build &&\ + rm -fr /root/.gem &&\ + rm -fr /root/.npm &&\ + rm -fr /tmp/* &&\ + rm -fr /usr/share/vim/vim74/spell/en* + + +# this can probably be done, but I worry that people changing PG locales will have issues +# cd /usr/share/locale && rm -fr `ls -d */ | grep -v en` + +RUN mkdir -p /etc/runit/3.d ADD runit-1 /etc/runit/1 ADD runit-1.d-cleanup-pids /etc/runit/1.d/cleanup-pids ADD runit-1.d-anacron /etc/runit/1.d/anacron +ADD runit-1.d-00-fix-var-logs /etc/runit/1.d/00-fix-var-logs ADD runit-2 /etc/runit/2 +ADD runit-3 /etc/runit/3 +ADD boot /sbin/boot 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 {} +