-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
51 lines (39 loc) · 1.61 KB
/
Dockerfile
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
FROM ruby:2.3
# Cleanup expired Let's Encrypt CA (Sept 30, 2021)
RUN sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf && update-ca-certificates -f
RUN echo 'deb http://archive.debian.org/debian stretch main\n\
deb http://archive.debian.org/debian-security stretch/updates main' > /etc/apt/sources.list
# Install dependencies
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /app
# Install gem bundle
ADD Gemfile /app/
ADD Gemfile.lock /app/
RUN bundle install --jobs 3 --deployment --without development test
# Default environment settings
ENV RAILS_SERVE_STATIC_FILES true
ENV LOG_TO_STDOUT true
ENV INSTEDD_THEME //theme.instedd.org
ENV RAILS_ENV production
ENV WEB_BIND_URI tcp://0.0.0.0:80
ENV PUMA_TAG resourcemap
ENV WEB_PUMA_FLAGS ""
# Install the application
ADD . /app
# Prevent resque connecting to redis on assets:precompile
RUN mv /app/config/initializers/resque_scheduler.rb /app/config/initializers/resque_scheduler.ignore
# Generate version file
RUN if [ -d .git ]; then git describe --always > VERSION; fi
# Precompile assets
RUN bundle exec rake assets:precompile RAILS_ENV=production SECRET_KEY_BASE=secret
# Restore resque initialization
RUN mv /app/config/initializers/resque_scheduler.ignore /app/config/initializers/resque_scheduler.rb
# Add config files
ADD docker/*.yml /app/config/
# Environment variables setup
# Guisso
# GUISSO_ENABLED GUISSO_URL GUISSO_CLIENT_ID GUISSO_CLIENT_SECRET
CMD exec bundle exec puma -e $RAILS_ENV -b $WEB_BIND_URI --tag $PUMA_TAG $WEB_PUMA_FLAGS