Skip to content
Dockerfile 1.58 KiB
Newer Older
Timothee Gosselin's avatar
Timothee Gosselin committed
ARG from=discourse/base
ARG tag=slim
ARG DISCOURSE_VERSION=test-passed
Timothee Gosselin's avatar
Timothee Gosselin committed
FROM $from:$tag
Pierre Ozoux's avatar
Pierre Ozoux committed

Pierre Ozoux's avatar
Pierre Ozoux committed
    DISCOURSE_SERVE_STATIC_ASSETS=true \
    EMBER_CLI_COMPILE_DONE=1 \
unteem's avatar
unteem committed
    EMBER_CLI_PROD_ASSETS=1 \
Pierre Ozoux's avatar
Pierre Ozoux committed
    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 \
Timothee Gosselin's avatar
Timothee Gosselin committed
    RUBY_GC_MALLOC_LIMIT=90000000
Timothee Gosselin's avatar
Timothee Gosselin committed
# jq needed to create kubernetes CM
RUN apt-get update && apt-get install -y jq
Timothee Gosselin's avatar
Timothee Gosselin committed
WORKDIR /var/www/discourse
Timothee Gosselin's avatar
Timothee Gosselin committed

RUN git config --global --add safe.directory /var/www/discourse &&\
    git remote set-branches --add origin ${DISCOURSE_VERSION} &&\
Timothee Gosselin's avatar
Timothee Gosselin committed
    git fetch --depth 1 origin ${DISCOURSE_VERSION} &&\
    sudo -u discourse bundle config --local deployment true &&\
    sudo -u discourse bundle config --local path ./vendor/bundle &&\
    sudo -u discourse bundle config --local without test development &&\
    sudo -u discourse bundle config --local jobs 4 && \
    sudo -u discourse bundle install &&\
    sudo -u discourse yarn install --frozen-lockfile  &&\
Timothee Gosselin's avatar
Timothee Gosselin committed
    sudo -u discourse yarn cache clean &&\
    find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} + &&\
    chown -R discourse:discourse /var/www/discourse
Pierre Ozoux's avatar
Pierre Ozoux committed

Timothee Gosselin's avatar
Timothee Gosselin committed
COPY install /tmp/install
Pierre Ozoux's avatar
Pierre Ozoux committed
USER discourse
Pierre Ozoux's avatar
Pierre Ozoux committed

Timothee Gosselin's avatar
Timothee Gosselin committed
RUN cd /var/www/discourse/plugins \
 && for plugin in $(cat /tmp/install/plugin-list); do \
      git clone $plugin; \
    done

RUN  cd app/assets/javascripts/discourse && \
     /var/www/discourse/app/assets/javascripts/node_modules/.bin/ember build -prod

CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]