-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
70 lines (62 loc) · 1.59 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
70
FROM alpine:3 AS alpine
ARG RAILS_ROOT=/usr/src/app
ENV RAILS_ROOT=${RAILS_ROOT}
USER root
WORKDIR $RAILS_ROOT
FROM alpine AS base
RUN apk add --no-cache \
libpq \
libxml2 \
libxslt \
libstdc++ \
ruby \
ruby-irb \
ruby-bigdecimal \
ruby-bundler \
ruby-json \
ruby-rake \
ruby-dev \
nodejs npm yarn \
tini \
tzdata \
gettext \
imagemagick \
shared-mime-info
FROM base as builder
RUN apk add --update --no-cache \
build-base \
libxml2-dev \
libxslt-dev \
libffi-dev \
pkgconf \
postgresql-dev \
yaml-dev \
zlib-dev \
curl-dev git \
&& ( echo 'install: --no-document' ; echo 'update: --no-document' ) >>/etc/gemrc
COPY . ./
RUN bundle config build.nokogiri --use-system-libraries \
&& bundle config set --local deployment 'true' \
&& bundle config set --local without 'development:test' \
&& bundle config set frozen false
RUN bundle install -j4 \
&& rm -rf vendor/bundle/ruby/*/cache \
&& find vendor/bundle/ruby/*/gems/ \( -name '*.c' -o -name '*.o' \) -delete
RUN yarn install --check-files
FROM base AS application
RUN apk add --no-cache \
bash \
postgresql-client
ARG RAILS_ENV
ENV RAILS_ENV=${RAILS_ENV:-production}
ARG BUILD_NUMBER
ENV BUILD_NUMBER=${BUILD_NUMBER}
COPY --from=builder /usr/src/app ./
FROM application
ARG PORT
ENV PORT=${PORT:-3000}
EXPOSE ${PORT}
# Precompile assets
RUN SECRET_KEY_BASE=1 RAILS_ENV=${RAILS_ENV:-production} RELATIVE_URL_ROOT=${RELATIVE_URL_ROOT:-lti} bundle exec rake assets:precompile --trace
# Run startup command
CMD ["scripts/start.sh"]