-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathDockerfile
55 lines (45 loc) · 1.45 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
FROM ruby:2.7.6-alpine3.15
WORKDIR /coyote
ARG bundle_without="development test"
RUN apk update \
&& apk upgrade \
&& apk add --no-cache gcompat \
&& apk add --update --no-cache --virtual .gyp python2 make g++ \
build-base \
git \
libxml2-dev \
libxslt-dev \
nodejs \
postgresql-client \
postgresql-dev \
ruby-json \
shared-mime-info \
tzdata \
yaml-dev \
yarn
# Copy all dependency files
ADD Gemfile Gemfile.lock package.json yarn.lock ./
# Install (and clean) Gem dependencies
RUN gem install bundler:`tail -1 Gemfile.lock | xargs` --no-document --conservative
RUN bundle config --global frozen 1 \
&& bundle config set without "${bundle_without}" \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle install --jobs=$(getconf _NPROCESSORS_ONLN) \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
# Install JavaScript dependencies
RUN yarn install
# Accept the remainder of the args (prevents rebuilding gems when we don't need to)
# ARG database_url
ARG env="production"
ENV RAILS_ENV=${env:-"production"}
ENV RACK_ENV=$RAILS_ENV
ENV NODE_ENV=$RAILS_ENV
ENV PORT=3000
# Copy and configure the app
ADD . ./
RUN if [ "$RAILS_ENV" = "production" ]; then bundle exec rails assets:precompile && bundle exec rails assets:precompile:pages; fi
# Launch!
EXPOSE $PORT
CMD ./bin/release && bundle exec puma -C config/puma.rb