This repository was archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (47 loc) · 1.77 KB
/
Dockerfile
File metadata and controls
60 lines (47 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
FROM ruby:2.7.2
ARG RENDER_EXTERNAL_HOSTNAME
ARG CUSTOM_DOMAIN
ARG DISCOURSE_WORKER_CONCURRENCY
ENV DISCOURSE_HOSTNAME=${CUSTOM_DOMAIN:-$RENDER_EXTERNAL_HOSTNAME}
ENV RAILS_ENV=production
ENV DISCOURSE_VERSION=v2.6.3
ENV DISCOURSE_ROOT=/var/www/discourse
ENV DISCOURSE_WORKER_CONCURRENCY=${DISCOURSE_WORKER_CONCURRENCY:-2}
WORKDIR $DISCOURSE_ROOT
RUN echo "DISCOURSE_HOSTNAME is: $DISCOURSE_HOSTNAME"
RUN git clone https://github.com/discourse/discourse.git --branch $DISCOURSE_VERSION --single-branch $DISCOURSE_ROOT
RUN apt-get update && apt-get install -y \
brotli \
libbrotli-dev \
gifsicle \
jhead \
jpegoptim \
nodejs \
npm \
optipng \
pngquant \
postgresql-client \
vim
RUN npm install -g svgo
RUN bundle config set path vendor/bundle/ && bundle install
RUN gem install foreman
# Configure NGINX
COPY install-nginx.sh /tmp/install-nginx.sh
RUN ldconfig && \
/tmp/install-nginx.sh && \
cp config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf && \
sed -i "s/^ server_name enter\\.your\\.web\\.hostname\\.here;/ server_name $DISCOURSE_HOSTNAME;/" /etc/nginx/conf.d/discourse.conf && \
mkdir -p /var/nginx/cache/
# Install Redis
COPY install-redis.sh /tmp/install-redis.sh
COPY redis.conf .
RUN /tmp/install-redis.sh
# Render offers free, fully managed SSL, so set default web setting to force HTTPS
RUN perl -i -p0e 's/ force_https:\n default: false/ force_https:\n default: true/' config/site_settings.yml
# Ensure socket, pid, and log files exist
RUN mkdir -p tmp/sockets/ tmp/pids/
RUN touch log/production.log
COPY puma.rb sidekiq.yml ./config/
COPY entrypoint.sh Procfile ./
RUN sed -i "s/^ :concurrency: 2/ :concurrency: ${DISCOURSE_WORKER_CONCURRENCY}/" config/sidekiq.yml
ENTRYPOINT [ "bash", "entrypoint.sh" ]