Newer
Older
Michał 'rysiek' Woźniak
committed
ENV RAILS_ENV=production \
DISCOURSE_DB_HOST=postgres \
DISCOURSE_REDIS_HOST=redis \
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 \
libbz2-dev \
libfreetype6-dev \
libjpeg-dev \
libjpeg-turbo-progs \
COPY install /tmp/install
RUN ls /tmp/ && ls /tmp/install
RUN curl http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION}-pgdg main" | \
tee /etc/apt/sources.list.d/postgres.list \
&& curl --silent --location https://deb.nodesource.com/setup_${NODE_MAJOR}.x | bash - \
&& apt-get update && apt-get install -y --no-install-recommends \
${BUILD_DEPS} \
postgresql-contrib-${PG_MAJOR} libpq-dev libreadline-dev \
&& mkdir /jemalloc-stable && cd /jemalloc-stable &&\
wget https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_STABLE}/jemalloc-${JEMALLOC_STABLE}.tar.bz2 &&\
tar -xjf jemalloc-${JEMALLOC_STABLE}.tar.bz2 && cd jemalloc-${JEMALLOC_STABLE} && ./configure --prefix=/usr && make && make install &&\
cd / && rm -rf /jemalloc-stable \
&& mkdir /jemalloc-new && cd /jemalloc-new &&\
wget https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_NEW}/jemalloc-${JEMALLOC_NEW}.tar.bz2 &&\
tar -xjf jemalloc-${JEMALLOC_NEW}.tar.bz2 && cd jemalloc-${JEMALLOC_NEW} && ./configure --prefix=/usr --with-install-suffix=${JEMALLOC_NEW} && make build_lib && make install_lib &&\
cd / && rm -rf /jemalloc-new \
&& gem update --system \
&& gem install bundler --force \
&& rm -rf /usr/local/share/ri/${RUBY_VERSION}/system \
&& /tmp/install/imagemagick \
# Validate install
&& 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 }" \
&& 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 ${DISCOURSE_VERSION} https://github.com/discourse/discourse.git \
&& 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 \
&& find /home/discourse/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} + \
RUN mkdir /oxipng-install && cd /oxipng-install &&\
wget https://github.com/shssoichiro/oxipng/releases/download/v5.0.0/oxipng-5.0.0-x86_64-unknown-linux-musl.tar.gz &&\
tar -xzf oxipng-5.0.0-x86_64-unknown-linux-musl.tar.gz && cd oxipng-5.0.0-x86_64-unknown-linux-musl &&\
cp oxipng /usr/local/bin &&\
cd / && rm -rf /oxipng-install
RUN cd /home/discourse/discourse/plugins \
&& for plugin in $(cat /tmp/install/plugin-list); do \
git clone $plugin; \
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]