-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
51 lines (36 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
40
41
42
43
44
45
46
47
48
49
50
51
FROM ruby:2.7.1-alpine as base
ENV BUNDLER_VERSION=2.1.4
RUN apk add --no-cache \
build-base \
file \
nodejs \
postgresql-dev \
tzdata \
yarn \
libnotify-dev
WORKDIR /app
COPY package.json yarn.lock /app/
RUN yarn install --frozen-lockfile
COPY Gemfile* /app/
RUN bundle config --local frozen 1 && \
bundle install --retry 3
COPY . /app
FROM base as build
ENV RAILS_SERVE_STATIC_FILES=true \
RAILS_LOG_TO_STDOUT=true
WORKDIR /app
RUN RAILS_ENV=production \
SECRET_KEY_BASE=dummy \
RAILS_MASTER_KEY=dummy \
bundle exec rails assets:precompile \
&& rm -rf "$(yarn cache dir)"
RUN bundle clean --force \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
RUN apk del yarn \
&& rm -rf app/assets node_modules tmp/cache vendor/bundle spec
COPY --from=base /usr/local/bundle/ /usr/local/bundle/
COPY --from=base . .
EXPOSE 3000
CMD ["rails", "server", "-p", "3000", "-b", "0.0.0.0"]