upgrade rubies, get ready for new image
[discourse_docker.git] / image / base / Dockerfile
1 # Official repo only has a ppa for postgresql 9.3 at the moment (14/3/2014)
2 # When new LTS ships we can upgrade
3
4 # NAME: discourse_base
5 # VERSION: 1.0.13
6
7 FROM ubuntu:14.04
8
9 MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
10
11 RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections &&\
12 echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list &&\
13 echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list &&\
14 echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list &&\
15 apt-get update && apt-get -y install fping &&\
16 sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true" &&\
17 apt-get -y install software-properties-common &&\
18 apt-mark hold initscripts &&\
19 apt-get -y upgrade &&\
20 add-apt-repository -y ppa:rwky/redis &&\
21 add-apt-repository -y ppa:nginx/development &&\
22 apt-get install -y curl && curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - &&\
23 echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" | \
24 tee /etc/apt/sources.list.d/postgres.list &&\
25 curl -sL https://deb.nodesource.com/setup | sudo bash - &&\
26 apt-get -y update &&\
27 apt-get -y install build-essential git curl wget \
28 libxslt-dev libcurl4-openssl-dev \
29 libssl-dev libyaml-dev libtool \
30 libxml2-dev gawk \
31 postgresql-9.3 postgresql-client-9.3 \
32 postgresql-contrib-9.3 libpq-dev libreadline-dev \
33 nginx language-pack-en sudo cron anacron \
34 psmisc rsyslog vim whois &&\
35 sed -i -e 's/start -q anacron/anacron -s/' /etc/cron.d/anacron &&\
36 sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf &&\
37 dpkg-divert --local --rename --add /sbin/initctl &&\
38 sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl" &&\
39 apt-get -y install redis-server haproxy openssh-server &&\
40 cd / &&\
41 apt-get -y install runit monit socat &&\
42 mkdir -p /etc/runit/1.d &&\
43 apt-get clean &&\
44 rm -f /etc/apt/apt.conf.d/40proxy &&\
45 locale-gen en_US &&\
46 wget http://static.jonof.id.au/dl/kenutils/pngout-20150319-linux.tar.gz &&\
47 tar -xf pngout-20150319-linux.tar.gz &&\
48 rm pngout-20150319-linux.tar.gz &&\
49 cp pngout-20150319-linux/x86_64/pngout /bin/pngout &&\
50 rm -rf pngout-20150319-linux &&\
51 apt-get install -y nodejs &&\
52 npm install uglify-js -g &&\
53 npm install svgo -g &&\
54 apt-get -y install advancecomp jhead jpegoptim libjpeg-progs optipng
55
56 # TODO check when binary packages are ready (not yet)
57 RUN wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2 &&\
58 tar -xjf phantomjs-1.9.8-linux-x86_64.tar.bz2 &&\
59 rm phantomjs-1.9.8-linux-x86_64.tar.bz2 &&\
60 cp phantomjs-1.9.8-linux-x86_64/bin/phantomjs /bin/phantomjs &&\
61 rm -fr phantomjs-1.9.8-linux-x86_64
62
63 RUN mkdir /jemalloc && cd /jemalloc &&\
64 wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2 &&\
65 tar -xjf jemalloc-3.6.0.tar.bz2 && cd jemalloc-3.6.0 && ./configure && make &&\
66 mv lib/libjemalloc.so.1 /usr/lib && cd / && rm -rf /jemalloc
67
68 ADD install-imagemagick /tmp/install-imagemagick
69 RUN /tmp/install-imagemagick
70
71 ADD install-pngcrush /tmp/install-pngcrush
72 RUN /tmp/install-pngcrush
73
74 ADD install-gifsicle /tmp/install-gifsicle
75 RUN /tmp/install-gifsicle
76
77 ADD install-pngquant /tmp/install-pngquant
78 RUN /tmp/install-pngquant
79
80 RUN add-apt-repository ppa:ubuntu-toolchain-r/test &&\
81 apt-get update &&\
82 apt-get install -y gcc-4.9 &&\
83 (cd /usr/bin && rm gcc && ln -s gcc-4.9 gcc) &&\
84 echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
85 mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\
86 cd /src/ruby-build && ./install.sh &&\
87 cd / && rm -rf /src/ruby-build && ruby-build 2.0.0-p647 /usr/local &&\
88 gem update --system &&\
89 gem install bundler &&\
90 rm -rf /usr/local/share/ri/2.0.0/system &&\
91 cd / && git clone https://github.com/SamSaffron/pups.git
92
93 # clean up for docker squash
94 RUN rm -fr /usr/share/man && rm -fr /usr/share/doc && mkdir -p /etc/runit/3.d
95
96 ADD runit-1 /etc/runit/1
97 ADD runit-1.d-cleanup-pids /etc/runit/1.d/cleanup-pids
98 ADD runit-1.d-anacron /etc/runit/1.d/anacron
99 ADD runit-2 /etc/runit/2
100 ADD runit-3 /etc/runit/3
101 ADD boot /sbin/boot
102
103 ADD cron /etc/service/cron/run
104 ADD rsyslog /etc/service/rsyslog/run