-
Notifications
You must be signed in to change notification settings - Fork 221
/
Dockerfile
69 lines (54 loc) · 1.55 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Dockerfile from
#
# https://intercityup.com/blog/how-i-build-a-docker-image-for-my-rails-app.html
#
# See more documentation at the passenger-docker GitHub repo:
#
# https://github.com/phusion/passenger-docker
#
#
FROM phusion/passenger-ruby32:2.6.1
MAINTAINER Autolab Development Team "[email protected]"
# Change to your time zone here
RUN ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
# Install dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
sqlite3 \
tzdata \
shared-mime-info
# Start Nginx / Passenger
RUN rm -f /etc/service/nginx/down
# Remove the default site
RUN rm /etc/nginx/sites-enabled/default
# Install gems
WORKDIR /tmp
ADD Gemfile .
ADD Gemfile.lock .
RUN chown app:app Gemfile Gemfile.lock
# Prepare folders
USER app
# Update rubygem to latest version
RUN gem update --system
# Specify bundler version
RUN gem install bundler -v $(tail -n1 Gemfile.lock)
RUN bundle install
RUN mkdir /home/app/webapp
WORKDIR /home/app/webapp
# Add the rails app
ADD . /home/app/webapp
USER root
# Create the log files
RUN mkdir -p /home/app/webapp/log && \
touch /home/app/webapp/log/production.log && \
chmod 0664 /home/app/webapp/log/production.log && \
chown -R app:app .
USER app
# precompile the Rails assets
ENV SECRET_KEY_BASE=dummy_secret_key_base
RUN RAILS_ENV=production bundle exec rails assets:precompile
# Clean up APT when done.
USER root
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]