-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile.production
46 lines (36 loc) · 1.3 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
42
43
44
45
46
FROM ruby:3.1-slim
LABEL maintainer="[email protected]"
RUN apt-get update -yqq && \
DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
automake \
autoconf \
build-essential \
curl \
default-libmysqlclient-dev \
git \
gnupg \
libyaml-dev \
nodejs \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
# Throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
RUN gem update --system
COPY Gemfile* package.json yarn.lock /app/
WORKDIR /app
RUN bundle config set deployment 'true'
RUN bundle install --jobs=4 --retry=3 --without="development test"
RUN yarn install
COPY . /app/
RUN RAILS_ENV=production DOCKER_BUILD=true bundle exec rails assets:precompile
CMD ["bundle", "exec", "--keep-file-descriptors", "puma", "-C", "config/puma.rb"]