-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
29 lines (19 loc) · 888 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
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
ADD ./Gemfile /rails_app/
ADD ./Gemfile.lock /rails_app/
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" ]