-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.production
41 lines (31 loc) · 1.32 KB
/
Dockerfile.production
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
FROM ruby:2.7.7-slim-buster
#Install dependencies as root
RUN apt-get update
RUN apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev libpq-dev curl
#Copy folder over
COPY . /usr/src/app
WORKDIR /usr/src/app
#Install npm/yarn
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g yarn
#Setup user
RUN useradd -ms /bin/bash automation-calculator-production
RUN usermod -a -G staff automation-calculator-production
RUN chown -R automation-calculator-production /usr/src/app
USER automation-calculator-production
#Install rails dependencies as non root user
RUN gem install nokogiri -v 1.14.1
RUN gem install bundler -v 2.3.26
#Calling bundle install in image creation to install dependencies,
# and also so that important bundle installed bins are in /usr/local/bundle/bin and thus in PATH variable for users.
RUN bundle install
#precompile static assets, set dummy SECRET_KEY_BASE to avoid this issue: https://github.com/heartcombo/devise/issues/4879
#note this var gets set on prod in a different way
ENV SECRET_KEY_BASE="dummy"
RUN rake assets:precompile
ENV SECRET_KEY_BASE=""
#Set this var to a reasonable default value, to be overridden per environment
ENV APP_HOSTNAME="automation-calculations.net"
ENTRYPOINT [ "/usr/src/app/entrypoint.sh" ]
CMD [ "rails", "s" ]