Everyone goes back to Jemalloc 3.6.0
[discourse_docker.git] / image / base / Dockerfile
CommitLineData
e8b9677b 1# NAME: discourse/base
5369fa7a 2# VERSION: 1.3.9
00dab51a 3FROM ubuntu:16.04
e1903539 4
8e8c1172 5ENV PG_MAJOR 9.5
af28cd0c 6ENV RUBY_ALLOCATOR /usr/lib/libjemalloc.so.1
8e8c1172 7
e1903539
SS
8MAINTAINER Sam Saffron "https://twitter.com/samsaffron"
9
ad5b2d96 10ADD VERSION /VERSION
0b72000a 11
00dab51a
GXT
12RUN apt-get update && apt-get install -y lsb-release sudo curl
13RUN echo "debconf debconf/frontend select Teletype" | debconf-set-selections
14RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main restricted universe" > /etc/apt/sources.list
15RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted universe" >> /etc/apt/sources.list
16RUN echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted universe" >> /etc/apt/sources.list
17RUN apt-get update && apt-get -y install fping
18RUN sh -c "fping proxy && echo 'Acquire { Retries \"0\"; HTTP { Proxy \"http://proxy:3128\";}; };' > /etc/apt/apt.conf.d/40proxy && apt-get update || true"
19RUN apt-get -y install software-properties-common
20RUN apt-mark hold initscripts
21RUN apt-get -y upgrade
00dab51a
GXT
22RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
23RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" | \
24 tee /etc/apt/sources.list.d/postgres.list
bddcde41 25RUN curl --silent --location https://deb.nodesource.com/setup_6.x | sudo bash -
00dab51a
GXT
26RUN apt-get -y update
27RUN apt-get -y install build-essential git wget \
d08dd53f
RH
28 libxslt-dev libcurl4-openssl-dev \
29 libssl-dev libyaml-dev libtool \
d821539c 30 libxml2-dev gawk parallel \
8785ccc5
RSS
31 postgresql-${PG_MAJOR} postgresql-client-${PG_MAJOR} \
32 postgresql-contrib-${PG_MAJOR} libpq-dev libreadline-dev \
e8b9677b 33 language-pack-en cron anacron \
c1594562 34 psmisc rsyslog vim whois brotli libunwind-dev
00dab51a
GXT
35RUN sed -i -e 's/start -q anacron/anacron -s/' /etc/cron.d/anacron
36RUN sed -i.bak 's/$ModLoad imklog/#$ModLoad imklog/' /etc/rsyslog.conf
37RUN dpkg-divert --local --rename --add /sbin/initctl
38RUN sh -c "test -f /sbin/initctl || ln -s /bin/true /sbin/initctl"
39RUN apt-get -y install redis-server haproxy openssh-server
40RUN cd / &&\
2cc4e49f 41 apt-get -y install runit monit socat &&\
23022c1d 42 mkdir -p /etc/runit/1.d &&\
d08dd53f 43 apt-get clean &&\
2bdce9f4 44 rm -f /etc/apt/apt.conf.d/40proxy &&\
be82e068 45 locale-gen en_US &&\
edcdd0c9 46 apt-get install -y nodejs &&\
fdc85645 47 npm install uglify-js -g &&\
00dab51a 48 npm install svgo -g
e8b9677b
S
49
50ADD install-nginx /tmp/install-nginx
51RUN /tmp/install-nginx
52
536ca9dd
S
53RUN apt-get -y install advancecomp jhead jpegoptim libjpeg-turbo-progs optipng
54
fdc85645
S
55
56RUN mkdir /jemalloc && cd /jemalloc &&\
5c7552e1
RSS
57 wget https://github.com/jemalloc/jemalloc/releases/download/3.6.0/jemalloc-3.6.0.tar.bz2 &&\
58 tar -xjf jemalloc-3.6.0.tar.bz2 && cd jemalloc-3.6.0 && ./configure --prefix=/usr && make && make install &&\
5e5e743d 59 cd / && rm -rf /jemalloc
fdc85645 60
c1594562
RSS
61RUN mkdir /gperftools && git clone https://github.com/gperftools/gperftools.git /gperftools &&\
62 cd /gperftools && git checkout gperftools-2.5 && ./autogen.sh && ./configure --prefix=$PWD/lib &&\
63 make install && mv lib/lib/libtcmalloc_minimal.so.4.3.0 /usr/lib && cd / && rm -rf /gperftools
64
65RUN mkdir /lockless && cd /lockless && curl -O https://locklessinc.com/downloads/lockless_allocator_linux.tgz &&\
66 tar zxf lockless_allocator_linux.tgz && mv lockless_allocator_linux/64bit/libllalloc.so.1.4 /usr/lib &&\
67 cd / && rm -rf /lockless
68
71c3c655
S
69RUN echo 'gem: --no-document' >> /usr/local/etc/gemrc &&\
70 mkdir /src && cd /src && git clone https://github.com/sstephenson/ruby-build.git &&\
84bb8fe7 71 cd /src/ruby-build && ./install.sh &&\
901cfb3e 72 cd / && rm -rf /src/ruby-build && ruby-build 2.3.3 /usr/local
71c3c655
S
73
74RUN gem install bundler &&\
75 rm -rf /usr/local/share/ri/2.3.0/system &&\
76 cd / && git clone https://github.com/SamSaffron/pups.git
77
8c9edf52
S
78ADD install-imagemagick /tmp/install-imagemagick
79RUN /tmp/install-imagemagick
80
71c3c655 81# Validate install
82a947fe 82RUN ruby -e "v='`convert -version`'; ['png','tiff','jpeg','freetype'].each{ |f| ((STDERR.puts('no ' + f + ' support in imagemagick')); exit(-1)) unless v.include?(f)}"
71c3c655
S
83
84#
fdc85645
S
85ADD install-pngcrush /tmp/install-pngcrush
86RUN /tmp/install-pngcrush
87
88ADD install-gifsicle /tmp/install-gifsicle
89RUN /tmp/install-gifsicle
90
91ADD install-pngquant /tmp/install-pngquant
92RUN /tmp/install-pngquant
5d6f9ed2 93
e8b9677b
S
94ADD phantomjs /usr/local/bin/phantomjs
95
96# Not using the official repo until they compile against a recent openssl
97# RUN cd tmp && wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
98# 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
dc7a8ede 99
05a13f9e 100# clean up for docker squash
536ca9dd
S
101RUN rm -fr /usr/share/man &&\
102 rm -fr /usr/share/doc &&\
103 rm -fr /usr/share/vim/vim74/tutor &&\
104 rm -fr /usr/share/vim/vim74/doc &&\
105 rm -fr /usr/share/vim/vim74/lang &&\
106 rm -fr /usr/local/share/doc &&\
107 rm -fr /usr/local/share/ruby-build &&\
108 rm -fr /root/.gem &&\
dc7a8ede
S
109 rm -fr /root/.npm &&\
110 rm -fr /tmp/* &&\
111 rm -fr /usr/share/vim/vim74/spell/en*
112
536ca9dd
S
113
114# this can probably be done, but I worry that people changing PG locales will have issues
115# cd /usr/share/locale && rm -fr `ls -d */ | grep -v en`
116
536ca9dd 117RUN mkdir -p /etc/runit/3.d
23022c1d
MB
118
119ADD runit-1 /etc/runit/1
120ADD runit-1.d-cleanup-pids /etc/runit/1.d/cleanup-pids
b8dfc9a7 121ADD runit-1.d-anacron /etc/runit/1.d/anacron
573617ea 122ADD runit-1.d-00-fix-var-logs /etc/runit/1.d/00-fix-var-logs
23022c1d 123ADD runit-2 /etc/runit/2
074f2b6a
S
124ADD runit-3 /etc/runit/3
125ADD boot /sbin/boot
be82e068
S
126
127ADD cron /etc/service/cron/run
128ADD rsyslog /etc/service/rsyslog/run
089e57a2 129ADD cron.d_anacron /etc/cron.d/anacron