-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vitalie
committed
May 26, 2023
1 parent
bab184f
commit 34bfe50
Showing
1 changed file
with
48 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,54 @@ | ||
FROM ruby:2.6.10-slim | ||
FROM ruby:2.6.10-slim as base | ||
|
||
LABEL maintainer Travis CI GmbH <[email protected]> | ||
|
||
# packages required for bundle install | ||
RUN ( \ | ||
apt-get update ; \ | ||
apt-get install -y --no-install-recommends git make gcc g++ \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
) | ||
# upgrade | ||
RUN apt-get update > /dev/null 2>&1 && \ | ||
apt-get upgrade -y > /dev/null 2>&1 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# throw errors if Gemfile has been modified since Gemfile.lock | ||
RUN bundle config --global frozen 1; | ||
RUN mkdir -p /app | ||
# Set app workdir | ||
WORKDIR /app | ||
|
||
# Copy app files into app folder | ||
COPY . /app | ||
# Upgrade rubygems | ||
RUN gem update --system > /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 | ||
|
||
RUN gem install bundler -v '2.0.1' | ||
RUN bundle install --deployment --without development test --clean | ||
# Copy app files | ||
COPY . ./ | ||
|
||
CMD bundle exec puma -C lib/travis/yml/web/puma.rb | ||
CMD ["bundle", "exec", "puma", "-C", "lib/travis/yml/web/puma.rb"] |