Upgrade base image to Ubuntu 16.04.
[discourse_docker.git] / image / base / Dockerfile
1 # NAME: discourse_base
2 # VERSION: 1.0.18
3
4 FROM ubuntu:16.04
5
6 ENV PG_MAJOR 9.5
7 ENV PG_VERSION 9.5.3-1.pgdg16.04+1
8
9 MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
10
11 RUN echo "1.0.13" > /VERSION
12
13 RUN apt-get update && apt-get install -y lsb-release sudo curl
14 RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections
15 RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list
16 RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list
17 RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list
18 RUN apt-get update && apt-get -y install fping
19 RUN sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true"
20 RUN apt-get -y install software-properties-common
21 RUN apt-mark hold initscripts
22 RUN apt-get -y upgrade
23 RUN add-apt-repository -y ppa:nginx/development
24 RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
25 RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | \
26 tee /etc/apt/sources.list.d/postgres.list
27 RUN curl --silent --location https://deb.nodesource.com/setup_4.x | sudo bash -
28 RUN apt-get -y update
29 RUN apt-get -y install build-essential git wget \
30 libxslt-dev libcurl4-openssl-dev \
31 libssl-dev libyaml-dev libtool \
32 libxml2-dev gawk parallel \
33 postgresql-${PG_MAJOR}=${PG_VERSION} postgresql-client-${PG_MAJOR}=${PG_VERSION} \
34 postgresql-contrib-${PG_MAJOR}=${PG_VERSION} libpq-dev libreadline-dev \
35 nginx language-pack-en cron anacron \
36 psmisc rsyslog vim whois
37 RUN sed -i -e 's/start -q anacron/anacron -s/' /etc/cron.d/anacron
38 RUN sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf
39 RUN dpkg-divert --local --rename --add /sbin/initctl
40 RUN sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl"
41 RUN apt-get -y install redis-server haproxy openssh-server
42 RUN cd / &&\
43 apt-get -y install runit monit socat &&\
44 mkdir -p /etc/runit/1.d &&\
45 apt-get clean &&\
46 rm -f /etc/apt/apt.conf.d/40proxy &&\
47 locale-gen en_US &&\
48 apt-get install -y nodejs &&\
49 npm install uglify-js -g &&\
50 npm install svgo -g
51 RUN apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng phantomjs
52
53 RUN mkdir /jemalloc && cd /jemalloc &&\
54 wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2 &&\
55 tar -xjf jemalloc-3.6.0.tar.bz2 && cd jemalloc-3.6.0 && ./configure && make &&\
56 mv lib/libjemalloc.so.1 /usr/lib && cd / && rm -rf /jemalloc
57
58 ADD install-imagemagick /tmp/install-imagemagick
59 RUN /tmp/install-imagemagick
60
61 ADD install-pngcrush /tmp/install-pngcrush
62 RUN /tmp/install-pngcrush
63
64 ADD install-gifsicle /tmp/install-gifsicle
65 RUN /tmp/install-gifsicle
66
67 ADD install-pngquant /tmp/install-pngquant
68 RUN /tmp/install-pngquant
69
70 RUN add-apt-repository ppa:ubuntu-toolchain-r/test &&\
71 apt-get update &&\
72 apt-get install -y gcc-4.9 &&\
73 (cd /usr/bin && rm gcc && ln -s gcc-4.9 gcc) &&\
74 echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
75 mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\
76 cd /src/ruby-build && ./install.sh &&\
77 cd / && rm -rf /src/ruby-build && ruby-build 2.3.1 /usr/local &&\
78 gem update --system &&\
79 gem install bundler &&\
80 rm -rf /usr/local/share/ri/2.3.1/system &&\
81 cd / && git clone https://github.com/SamSaffron/pups.git
82
83 # clean up for docker squash
84 RUN rm -fr /usr/share/man && rm -fr /usr/share/doc && mkdir -p /etc/runit/3.d
85
86 ADD runit-1 /etc/runit/1
87 ADD runit-1.d-cleanup-pids /etc/runit/1.d/cleanup-pids
88 ADD runit-1.d-anacron /etc/runit/1.d/anacron
89 ADD runit-2 /etc/runit/2
90 ADD runit-3 /etc/runit/3
91 ADD boot /sbin/boot
92
93 ADD cron /etc/service/cron/run
94 ADD rsyslog /etc/service/rsyslog/run