forked from hansode/ruby-2.1.x-rpm
-
Notifications
You must be signed in to change notification settings - Fork 43
/
Dockerfile-7
45 lines (31 loc) · 1023 Bytes
/
Dockerfile-7
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
#
# base image
#
FROM centos:7 AS base
MAINTAINER feedforce Inc.
# setup
RUN yum install -y rpm-build tar make
# ruby depends
RUN yum -y install readline-devel ncurses-devel gdbm-devel glibc-devel gcc openssl-devel libyaml-devel libffi-devel zlib-devel
#
# builder image
#
FROM base AS builder
ARG RUBY_X_Y_VERSION
# rpmbuild command recommends to use `builder:builder` as user:group.
RUN useradd -u 1000 builder
RUN mkdir -p /home/builder/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
RUN mkdir -p /home/builder/ruby-rpm
RUN chown -R builder:builder /home/builder/rpmbuild
RUN chown -R builder:builder /home/builder/ruby-rpm
WORKDIR /home/builder/ruby-rpm
USER builder
COPY . /home/builder/ruby-rpm/
RUN /home/builder/ruby-rpm/scripts/build-rpm.sh $RUBY_X_Y_VERSION
#
# tester image
#
FROM base AS tester
ARG RUBY_X_Y_VERSION
COPY --from=builder /tmp/ruby-$RUBY_X_Y_VERSION-rpm /tmp/ruby-$RUBY_X_Y_VERSION-rpm
RUN yum install -y /tmp/ruby-$RUBY_X_Y_VERSION-rpm/ruby-$RUBY_X_Y_VERSION.*.$(uname -m).rpm