Skip to content

Commit 117915c

Browse files
author
vitalie
committed
Docker updates
1 parent bab184f commit 117915c

File tree

1 file changed

+48
-17
lines changed

1 file changed

+48
-17
lines changed

Dockerfile

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
1-
FROM ruby:2.6.10-slim
1+
FROM ruby:2.6.10-slim as base
22

3-
LABEL maintainer Travis CI GmbH <support+travis-live-docker-images@travis-ci.com>
4-
5-
# packages required for bundle install
6-
RUN ( \
7-
apt-get update ; \
8-
apt-get install -y --no-install-recommends git make gcc g++ \
9-
&& rm -rf /var/lib/apt/lists/* \
10-
)
3+
# upgrade
4+
RUN apt-get update > /dev/null 2>&1 && \
5+
apt-get upgrade -y > /dev/null 2>&1 && \
6+
rm -rf /var/lib/apt/lists/*
117

12-
# throw errors if Gemfile has been modified since Gemfile.lock
13-
RUN bundle config --global frozen 1;
14-
RUN mkdir -p /app
8+
# Set app workdir
159
WORKDIR /app
1610

17-
# Copy app files into app folder
18-
COPY . /app
11+
# Upgrade rubygems
12+
RUN gem update --system 3.4.13 > /dev/null 2>&1
13+
14+
# Gem config
15+
RUN echo "gem: --no-document" >> ~/.gemrc
16+
17+
# Bundle config
18+
RUN bundle config set --global no-cache 'true' && \
19+
bundle config set --global frozen 'true' && \
20+
bundle config set --global deployment 'true' && \
21+
bundle config set --global without 'development test' && \
22+
bundle config set --global clean 'true' && \
23+
bundle config set --global jobs `expr $(cat /proc/cpuinfo | grep -c 'cpu cores')` && \
24+
bundle config set --global retry 3
25+
26+
FROM base as builder
27+
28+
# packages required
29+
RUN apt-get update > /dev/null 2>&1 && \
30+
apt-get install -y --no-install-recommends git make gcc g++ > /dev/null 2>&1 && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
# Copy .ruby-version and .gemspec into container
34+
COPY .ruby-version travis-yml.gemspec ./
35+
COPY ./lib/travis/yml/version.rb ./lib/travis/yml/version.rb
36+
37+
# Copy gemfiles into container
38+
COPY Gemfile Gemfile.lock ./
39+
40+
# Install gems
41+
RUN bundle install
42+
43+
44+
FROM base
45+
46+
LABEL maintainer Travis CI GmbH <support+travis-live-docker-images@travis-ci.com>
47+
48+
# Copy gems from builder
49+
COPY --from=builder /usr/local/bundle /usr/local/bundle
1950

20-
RUN gem install bundler -v '2.0.1'
21-
RUN bundle install --deployment --without development test --clean
51+
# Copy app files
52+
COPY . ./
2253

23-
CMD bundle exec puma -C lib/travis/yml/web/puma.rb
54+
CMD ["bundle", "exec", "puma", "-C", "lib/travis/yml/web/puma.rb"]

0 commit comments

Comments
 (0)