18947: Remove errant uses of runsu.sh.
[arvados.git] / build / package-build-dockerfiles / centos7 / Dockerfile
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 ARG HOSTTYPE
6 ARG BRANCH
7
8 FROM centos:7 as build_x86_64
9 # Install go
10 ONBUILD ADD generated/go1.17.1.linux-amd64.tar.gz /usr/local/
11 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
12 # Install nodejs and npm
13 ONBUILD ADD generated/node-v10.23.1-linux-x64.tar.xz /usr/local/
14 ONBUILD RUN ln -s /usr/local/node-v10.23.1-linux-x64/bin/* /usr/local/bin/
15
16 FROM centos:7 as build_aarch64
17 # Install go
18 ONBUILD ADD generated/go1.17.1.linux-arm64.tar.gz /usr/local/
19 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
20 # Install nodejs and npm
21 ONBUILD ADD generated/node-v10.23.1-linux-arm64.tar.xz /usr/local/
22 ONBUILD RUN ln -s /usr/local/node-v10.23.1-linux-arm64/bin/* /usr/local/bin/
23
24 FROM build_${HOSTTYPE}
25
26 MAINTAINER Arvados Package Maintainers <packaging@arvados.org>
27
28 ENV DEBIAN_FRONTEND noninteractive
29
30 SHELL ["/bin/bash", "-c"]
31 # Install dependencies.
32 RUN yum -q -y install make automake gcc gcc-c++ libyaml-devel patch readline-devel zlib-devel libffi-devel openssl-devel bzip2 libtool bison sqlite-devel rpm-build git perl-ExtUtils-MakeMaker libattr-devel nss-devel libcurl-devel which tar unzip scl-utils centos-release-scl postgresql-devel fuse-devel xz-libs git wget pam-devel
33
34 # Install RVM
35 ADD generated/mpapis.asc /tmp/
36 ADD generated/pkuczynski.asc /tmp/
37 RUN gpg --import --no-tty /tmp/mpapis.asc && \
38     gpg --import --no-tty /tmp/pkuczynski.asc && \
39     curl -L https://get.rvm.io | bash -s stable && \
40     /usr/local/rvm/bin/rvm install 2.7 -j $(grep -c processor /proc/cpuinfo) && \
41     /usr/local/rvm/bin/rvm alias create default ruby-2.7 && \
42     echo "gem: --no-document" >> ~/.gemrc && \
43     /usr/local/rvm/bin/rvm-exec default gem install bundler --version 2.2.19 && \
44     /usr/local/rvm/bin/rvm-exec default gem install fpm --version 1.10.2
45
46 # Install Bash 4.4.12 // see https://dev.arvados.org/issues/15612
47 RUN cd /usr/local/src \
48 && wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz \
49 && wget http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz.sig \
50 && tar xzf bash-4.4.12.tar.gz \
51 && cd bash-4.4.12 \
52 && ./configure --prefix=/usr/local/$( basename $( pwd ) ) \
53 && make \
54 && make install \
55 && ln -sf /usr/local/src/bash-4.4.12/bash /bin/bash
56
57 # Need to "touch" RPM database to workaround bug in interaction between
58 # overlayfs and yum (https://bugzilla.redhat.com/show_bug.cgi?id=1213602)
59 RUN touch /var/lib/rpm/* && yum -q -y install python3 python3-pip python3-devel
60
61 # Install virtualenv
62 RUN /usr/bin/pip3 install 'virtualenv<20'
63
64 RUN /usr/local/rvm/bin/rvm-exec default bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
65 # Cf. https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/
66 ENV MAKE "make --jobs $(grep -c processor /proc/cpuinfo)"
67
68 # Preseed the go module cache and the ruby gems, using the currently checked
69 # out branch of the source tree. This avoids potential compatibility issues
70 # between the version of Ruby and certain gems.
71 RUN git clone --depth 1 git://git.arvados.org/arvados.git /tmp/arvados && \
72     cd /tmp/arvados && \
73     if [[ -n "${BRANCH}" ]]; then git checkout ${BRANCH}; fi && \
74     cd /tmp/arvados/services/api && \
75     /usr/local/rvm/bin/rvm-exec default bundle install && \
76     cd /tmp/arvados/apps/workbench && \
77     /usr/local/rvm/bin/rvm-exec default bundle install && \
78     cd /tmp/arvados && \
79     go mod download
80
81 # The version of setuptools that comes with CentOS is way too old
82 RUN pip3 install 'setuptools<45'
83
84 ENV WORKSPACE /arvados
85 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "centos7"]