Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit e798739

Browse files
ghostsquadjtarchie
authored andcommitted
Improve build layer caching
1 parent 4242846 commit e798739

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
1+
# Stage: Base
12
FROM alpine as resource
23

3-
RUN apk add --update ca-certificates
4-
RUN apk add --update curl
5-
RUN apk add --update git
6-
RUN apk add --update jq
7-
RUN apk add --update openssh-client
8-
RUN apk add --update perl
9-
RUN apk add --update ruby
10-
RUN apk add --update ruby-json
11-
RUN gem install octokit activesupport httpclient faraday-http-cache --no-rdoc --no-ri
4+
RUN set -ex; \
5+
apk add --update \
6+
ca-certificates \
7+
curl \
8+
git \
9+
jq \
10+
openssh-client \
11+
perl \
12+
ruby \
13+
ruby-json \
14+
ruby-bundler \
15+
; \
16+
rm -rf /var/cache/apk/*;
1217

18+
ADD Gemfile Gemfile.lock /opt/resource/
19+
RUN cd /opt/resource && bundle install --without test development
1320
ADD assets/ /opt/resource/
1421
RUN chmod +x /opt/resource/*
1522
ADD scripts/install_git_lfs.sh install_git_lfs.sh
1623
RUN ./install_git_lfs.sh
1724

25+
# Stage: Testing
1826
FROM resource as tests
19-
COPY . /resource
2027

2128
RUN apk add --update \
2229
ruby-bundler \
2330
ruby-io-console \
2431
ruby-dev \
2532
openssl-dev \
2633
alpine-sdk
27-
RUN cd /resource && bundle install && bundle exec rspec
2834

35+
COPY Gemfile Gemfile.lock /resource/
36+
37+
RUN cd /resource && bundle install
38+
39+
COPY . /resource
40+
41+
RUN cd /resource && rspec
42+
43+
# Stage: Final
2944
FROM resource

0 commit comments

Comments
 (0)