-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
43 lines (31 loc) · 1.18 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
FROM public.ecr.aws/docker/library/ruby:3.2-alpine AS build-env
ARG APP_ROOT="/app"
ENV BUNDLE_APP_CONFIG="/app/.bundle"
RUN apk update && \
apk upgrade && \
apk add --update --no-cache build-base gcompat git postgresql-dev nodejs yarn && \
gem install bundler
RUN mkdir -p $APP_ROOT
WORKDIR $APP_ROOT
COPY Gemfile Gemfile.lock package.json yarn.lock $APP_ROOT/
RUN bundle config --local deployment true && \
bundle config --local force_ruby_platform true \
bundle config --local path "vendor/bundle" && \
bundle config --local without 'development test'
RUN bundle install --jobs 20 --retry 5
RUN yarn install --frozen-lockfile
COPY . .
RUN bundle exec rails assets:precompile
RUN mkdir -p tmp/pids
RUN rm -rf vendor/bundle/ruby/*/cache/ && find vendor/ -name "*.o" -delete && find vendor/ -name "*.c"
FROM public.ecr.aws/docker/library/ruby:3.2-alpine
ARG APP_ROOT="/app"
ENV BUNDLE_APP_CONFIG="/app/.bundle"
WORKDIR $APP_ROOT
RUN apk update && \
apk upgrade && \
apk add --update --no-cache build-base gcompat postgresql-dev && \
gem install bundler
COPY --from=build-env $APP_ROOT $APP_ROOT
EXPOSE 3000
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]