-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
92 lines (71 loc) · 3.16 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG BASE_IMAGE=docker.io/ruby:3.2.5-alpine3.20
FROM $BASE_IMAGE AS builder
# Gems have to be ARG and ENV because they are used as reference in the Gemfile
ARG RUBYGEM_PUPPET
ENV RUBYGEM_PUPPET=${RUBYGEM_PUPPET:-8.10.0}
ARG RUBYGEM_FACTER
ENV RUBYGEM_FACTER=${RUBYGEM_FACTER:-4.10.0}
ARG RUBYGEM_VOXPUPULI_TEST
ENV RUBYGEM_VOXPUPULI_TEST=${RUBYGEM_VOXPUPULI_TEST:-9.2.0}
ARG RUBYGEM_VOXPUPULI_ACCEPTANCE
ENV RUBYGEM_VOXPUPULI_ACCEPTANCE=${RUBYGEM_VOXPUPULI_ACCEPTANCE:-3.2.0}
ARG RUBYGEM_VOXPUPULI_RELEASE
ENV RUBYGEM_VOXPUPULI_RELEASE=${RUBYGEM_VOXPUPULI_RELEASE:-3.1.0}
ARG RUBYGEM_PUPPET_METADATA
ENV RUBYGEM_PUPPET_METADATA=${RUBYGEM_PUPPET_METADATA:-4.5.0}
ARG RUBYGEM_MODULESYNC
ENV RUBYGEM_MODULESYNC=${RUBYGEM_MODULESYNC:-3.2.0}
ARG RUBYGEM_R10K
ENV RUBYGEM_R10K=${RUBYGEM_R10K:-4.1.0}
ARG RUBYGEM_RA10KE
ENV RUBYGEM_RA10KE=${RUBYGEM_RA10KE:-3.1.0}
ARG RUBYGEM_RUBOCOP_PERFORMANCE
ENV RUBYGEM_RUBOCOP_PERFORMANCE=${RUBYGEM_RUBOCOP_PERFORMANCE:-1.23.0}
ARG RUBYGEM_BUNDLER
ENV RUBYGEM_BUNDLER=${RUBYGEM_BUNDLER:-2.5.23}
COPY voxbox/Gemfile /
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update alpine-sdk \
&& rm -rf /usr/local/lib/ruby/gems/*/gems/bundler-* \
&& rm -rf /usr/local/lib/ruby/gems/*/specifications/default/bundler-*.gemspec \
&& gem install bundler -v ${RUBYGEM_BUNDLER} \
&& bundle config set path.system true \
&& bundle config set jobs $(nproc) \
&& bundle install --gemfile=/Gemfile \
&& rm -rf /usr/local/lib/ruby/gems/*/cache/* \
&& rm -rf /usr/local/lib/ruby/gems/*/gems/cgi-* \
&& rm -rf /usr/local/lib/ruby/gems/*/specifications/default/cgi-*.gemspec \
&& rm -rf /usr/local/lib/ruby/gems/*/gems/stringio-* \
&& rm -rf /usr/local/lib/ruby/gems/*/specifications/default/stringio-*.gemspec \
&& rm -rf /usr/local/lib/ruby/gems/*/gems/rdoc-* \
&& rm -rf /usr/local/lib/ruby/gems/*/specifications/default/rdoc-*.gemspec \
&& rm -rf /usr/local/lib/ruby/gems/2.7.0/gems/default/rexml-* \
&& rm -rf /usr/local/lib/ruby/gems/2.7.0/specifications/default/rexml-*.gemspec \
&& rm -rf /usr/local/lib/ruby/gems/*/gems/rexml-* \
&& rm -rf /usr/local/lib/ruby/gems/*/specifications/rexml-*.gemspec
###############################################################################
FROM $BASE_IMAGE AS final
LABEL org.label-schema.maintainer="Voxpupuli Team <[email protected]>" \
org.label-schema.vendor="Voxpupuli" \
org.label-schema.url="https://github.com/voxpupuli/container-voxbox" \
org.label-schema.name="Vox Pupuli Test Box" \
org.label-schema.license="AGPL-3.0-or-later" \
org.label-schema.vcs-url="https://github.com/voxpupuli/container-voxbox" \
org.label-schema.schema-version="1.0" \
org.label-schema.dockerfile="/Dockerfile"
RUN apk update \
&& apk upgrade \
&& apk add jq \
&& apk add yamllint \
&& apk add git \
&& apk add curl \
&& rm -rf /var/cache/apk/* \
&& rm -rf /usr/local/lib/ruby/gems
COPY --from=builder /usr/local/lib/ruby/gems /usr/local/lib/ruby/gems
COPY --from=builder /usr/local/bundle /usr/local/bundle
COPY Dockerfile /
COPY voxbox/Rakefile /
WORKDIR /repo
ENTRYPOINT [ "rake" ]
CMD [ "-f", "/Rakefile", "-T" ]