forked from NoBrainerORM/nobrainer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
59 lines (45 loc) · 1.43 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
57
58
59
#
# Builds a temporary image, with all the required dependencies used to compile
# the dependencies' dependencies.
# This image will be destroyed at the end of the build command.
#
FROM ruby:2.7-alpine3.12 AS build-env
ARG GEM_ROOT=/gem
ARG BUILD_PACKAGES="build-base git"
ARG DEV_PACKAGES=""
ARG RUBY_PACKAGES="tzdata"
RUN apk update && \
apk upgrade && \
apk add --update --no-cache $BUILD_PACKAGES \
$DEV_PACKAGES \
$RUBY_PACKAGES && \
mkdir -p /gem/
WORKDIR $GEM_ROOT
COPY Gemfile* *.gemspec /gem/
RUN touch ~/.gemrc && \
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
gem install rubygems-update && \
update_rubygems && \
gem install bundler && \
bundle install --jobs $(nproc) && \
rm -rf /usr/local/bundle/cache/*.gem && \
find /usr/local/bundle/gems/ -name "*.c" -delete && \
find /usr/local/bundle/gems/ -name "*.o" -delete
COPY . /gem/
#
# Builds the final image with the minimum of system packages
# and copy the gem's sources, Bundler gems and Yarn packages.
#
FROM ruby:2.7-alpine3.12
LABEL maintainer="zedtux"
ARG GEM_ROOT=/gem
ARG PACKAGES="git tzdata"
RUN apk update && \
apk upgrade && \
apk add --update --no-cache $PACKAGES && \
mkdir -p /gem/
WORKDIR $GEM_ROOT
COPY --from=build-env /usr/local/bundle/ /usr/local/bundle/
COPY --from=build-env $GEM_ROOT $GEM_ROOT
ENTRYPOINT ["bundle", "exec"]
CMD ["rake"]