-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathDockerfile.test
74 lines (62 loc) · 1.8 KB
/
Dockerfile.test
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM bash AS base
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ASDF_DIR=/root/.asdf
# Install dependencies
RUN apk update && \
apk add --no-cache \
build-base \
git \
libffi-dev \
openssl-dev \
perl \
readline-dev \
tzdata \
yaml-dev \
zlib-dev
RUN git clone https://github.com/asdf-vm/asdf.git /root/.asdf --branch v0.14.0 && \
. "$ASDF_DIR/asdf.sh" && \
asdf plugin add ruby
## For parallelism, build in stages
# Ruby 3.0.7
FROM base AS ruby-3.0.7
RUN . "$ASDF_DIR/asdf.sh" && \
asdf install ruby 3.0.7 && \
asdf global ruby 3.0.7 && \
gem install bundler
# Ruby 3.1.4
FROM base AS ruby-3.1.4
RUN . "$ASDF_DIR/asdf.sh" && \
asdf install ruby 3.1.4 && \
asdf global ruby 3.1.4 && \
gem install bundler
# Ruby 3.2.2
FROM base AS ruby-3.2.2
RUN . "$ASDF_DIR/asdf.sh" && \
asdf install ruby 3.2.2 && \
asdf global ruby 3.2.2 && \
gem install bundler
# Ruby 3.3.4
FROM base AS ruby-3.3.4
RUN . "$ASDF_DIR/asdf.sh" && \
asdf install ruby 3.3.4 && \
asdf global ruby 3.3.4 && \
gem install bundler
# Final Image with Application Code
FROM base AS final
# Copy and merge installed ASDF directory from ruby versions
COPY --from=ruby-3.0.7 /root/.asdf /tmp/.asdf-3.0.7
COPY --from=ruby-3.1.4 /root/.asdf /tmp/.asdf-3.1.4
COPY --from=ruby-3.2.2 /root/.asdf /tmp/.asdf-3.2.2
COPY --from=ruby-3.3.4 /root/.asdf /tmp/.asdf-3.3.4
RUN cp -r /tmp/.asdf-3.0.7/* /root/.asdf/ && \
cp -r /tmp/.asdf-3.1.4/* /root/.asdf/ && \
cp -r /tmp/.asdf-3.2.2/* /root/.asdf/ && \
cp -r /tmp/.asdf-3.3.4/* /root/.asdf/ && \
rm -rf /tmp/.asdf*
WORKDIR /app
COPY gemfiles gemfiles
COPY lib lib
COPY spec spec
COPY cached_resource.gemspec Gemfile Rakefile scripts/docker/run_tests.sh .standard.yml .
CMD ["./run_tests.sh"]