-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
39 lines (29 loc) · 1.02 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
FROM ruby:3.1-slim
WORKDIR /rails_app
RUN apt-get update && apt-get -y upgrade && \
apt-get install --no-install-recommends -y \
build-essential \
# remove git once panoptes-client.rb is updated to >= v.0.4
git \
libpq-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ARG RAILS_ENV=production
ENV RAILS_ENV=$RAILS_ENV
ADD ./Gemfile /rails_app/
ADD ./Gemfile.lock /rails_app/
RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1` && \
if echo "development test" | grep -w "$RAILS_ENV"; then \
bundle install; \
else \
# switch to new config syntax for non dev/test gem group installs
bundle config set --local without 'development test'; \
bundle install; \
fi
ADD ./ /rails_app
RUN if echo "staging production" | grep -w "$RAILS_ENV"; then \
bundle exec bootsnap precompile --gemfile app/ lib/; \
fi
ARG REVISION=''
ENV REVISION=$REVISION
EXPOSE 80
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]