-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.rails-next
33 lines (22 loc) · 1.02 KB
/
Dockerfile.rails-next
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
FROM ruby:2.7-slim-buster
WORKDIR /rails_app
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,id=talk-apt-cache,target=/var/cache/apt --mount=type=cache,id=talk-apt-lib,target=/var/lib/apt \
apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
git \
libpq-dev \
tmpreaper
ARG RAILS_ENV=production
ENV RAILS_ENV=$RAILS_ENV
ADD ./Gemfile.next /rails_app/
ADD ./Gemfile.next.lock /rails_app/
# ensure we use the rails-next gemfile setup to ensure we boot the upgraded libaries
ENV BUNDLE_GEMFILE=Gemfile.next
RUN bundle config --global jobs `cat /proc/cpuinfo | grep processor | wc -l | xargs -I % expr % - 1`
RUN if [ "$RAILS_ENV" = "development" ]; then bundle install; else bundle install --without development test; fi
ADD ./ /rails_app
RUN (git log --format="%H" -n 1 > /rails_app/public/commit_id.txt && rm -rf .git)
EXPOSE 81
CMD [ "/rails_app/docker/start.sh" ]