Newer
Older
Michał 'rysiek' Woźniak
committed
ENV RAILS_ENV=production \
DISCOURSE_DB_HOST=postgres \
DISCOURSE_REDIS_HOST=redis \
GIFSICLE_VERSION=1.91 \
PNGQUANT_VERSION=2.12.1 \
PNGCRUSH_VERSION=1.8.13 \
DISCOURSE_VERSION=2.2.0.beta4 \
PG_MAJOR=10 \
libbz2-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg-turbo-progs \
RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | \
tee /etc/apt/sources.list.d/postgres.list
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | bash - \
&& apt-get update && apt-get install -y --no-install-recommends \
${BUILD_DEPS} \
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
jhead \
postgresql-client-${PG_MAJOR} \
postgresql-contrib-${PG_MAJOR} libpq-dev libreadline-dev
RUN npm install svgo uglify-js@"<3" -g
RUN mkdir /jemalloc-stable && cd /jemalloc-stable &&\
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-stable
RUN mkdir /jemalloc-new && cd /jemalloc-new &&\
wget https://github.com/jemalloc/jemalloc/releases/download/5.1.0/jemalloc-5.1.0.tar.bz2 &&\
tar -xjf jemalloc-5.1.0.tar.bz2 && cd jemalloc-5.1.0 && ./configure --prefix=/usr --with-install-suffix=5.1.0 && make build_lib && make install_lib &&\
cd / && rm -rf /jemalloc-new
RUN gem update --system
RUN gem install bundler --force \
&& rm -rf /usr/local/share/ri/2.5.2/system
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 }"
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
RUN addgroup --gid 1000 discourse \
&& adduser --system --uid 1000 --ingroup discourse --shell /bin/bash discourse \
&& cd /home/discourse \
&& mkdir -p tmp/pids \
&& mkdir -p ./tmp/sockets \
&& git clone --branch v${DISCOURSE_VERSION} https://github.com/discourse/discourse.git \
&& chown -R discourse:discourse . \
&& sed -i 's/daemonize true/daemonize false/g' ./config/puma.rb \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install --deployment --verbose --without test --without development --retry 3 --jobs 4
RUN find /home/discourse/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +
# RUN apt-get remove -y --purge ${BUILD_DEPS} \
# && apt-get autoremove -y \
# && rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/lib/apt/lists/*
ENV RAILS_ENV=production \
RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 \
RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 \
RUBY_GC_HEAP_INIT_SLOTS=400000 \
RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 \
RUBY_GC_MALLOC_LIMIT=90000000
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]