-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
35 lines (30 loc) · 913 Bytes
/
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
FROM ruby:3.1.2-slim as setup
RUN apt-get update -qq && apt-get install -y libpq-dev build-essential
RUN apt-get install -y software-properties-common
RUN gem install bundler:2.2.19
FROM setup as build
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
ENV BUNDLE_PATH /gems
VOLUME [ "/gems" ]
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
FROM build as dev
EXPOSE 3000
RUN apt-get install iputils-ping
RUN bundle config set --local without production
RUN bundle install --jobs 4 --retry 5
COPY . /app
ENTRYPOINT ["entrypoint.sh"]
CMD ["bin/rails", "server", "-b", "0.0.0.0"]
FROM build as live
EXPOSE 80
ENV RAILS_ENV production
ENV RACK_ENV production
ENV RAILS_LOG_TO_STDOUT enabled
RUN bundle config set --local without test development
RUN bundle install --jobs 4 --retry 5
COPY . /app
ENTRYPOINT ["entrypoint.sh"]
CMD ["bin/rails", "server", "-b", "0.0.0.0"]