-
Notifications
You must be signed in to change notification settings - Fork 90
/
Dockerfile
56 lines (39 loc) · 1.48 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
52
53
54
55
56
FROM ruby:3.2.2-slim as base
# upgrade
RUN apt-get update > /dev/null 2>&1 && \
apt-get upgrade -y > /dev/null 2>&1 && \
rm -rf /var/lib/apt/lists/*
# Set app workdir
WORKDIR /app
# Upgrade rubygems
RUN gem update --system 3.4.13 > /dev/null 2>&1
# Gem config
RUN echo "gem: --no-document" >> ~/.gemrc
# Bundle config
RUN bundle config set --global no-cache 'true' && \
bundle config set --global frozen 'true' && \
bundle config set --global deployment 'true' && \
bundle config set --global without 'development test' && \
bundle config set --global clean 'true' && \
bundle config set --global jobs `expr $(cat /proc/cpuinfo | grep -c 'cpu cores')` && \
bundle config set --global retry 3
FROM base as builder
# packages required
RUN apt-get update > /dev/null 2>&1 && \
apt-get install -y --no-install-recommends git make gcc g++ > /dev/null 2>&1 && \
rm -rf /var/lib/apt/lists/*
# Copy .ruby-version and .gemspec into container
COPY .ruby-version travis-yml.gemspec ./
COPY ./lib/travis/yml/version.rb ./lib/travis/yml/version.rb
# Copy gemfiles into container
COPY Gemfile Gemfile.lock ./
# Install gems
RUN bundle install
FROM base
LABEL maintainer Travis CI GmbH <[email protected]>
# Copy gems from builder
COPY --from=builder /usr/local/bundle /usr/local/bundle
COPY --from=builder /app/vendor ./vendor
# Copy app files
COPY . ./
CMD ["sh", "-c", "bundle exec bin/docs && bundle exec puma -C lib/travis/yml/web/puma.rb"]