1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
8 FROM ubuntu:focal as build_x86_64
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 # On x86, we want some cross-compilation support for arm64
16 # Add gcc-aarch64-linux-gnu to compile go binaries for arm64
17 ONBUILD RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y gcc-aarch64-linux-gnu
18 # We also need libpam compiled for arm64, and that requires some sources.list mangling
19 ONBUILD RUN /bin/sed -i 's/deb http/deb [ arch=amd64 ] http/' /etc/apt/sources.list
20 ONBUILD ADD ports.list /etc/apt/sources.list.d/
21 ONBUILD RUN /usr/bin/dpkg --add-architecture arm64
22 ONBUILD RUN /usr/bin/apt-get update && /usr/bin/apt-get install -o APT::Immediate-Configure=0 -q -y libpam0g-dev:arm64
23 # Note that cross compilation support for ubuntu2004 is disabled in
24 # run-library.sh because of
25 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477. Hopefully
26 # ubuntu2204 will have the fix introduced in debian11.
28 FROM ubuntu:focal as build_aarch64
30 ONBUILD ADD generated/go1.17.1.linux-arm64.tar.gz /usr/local/
31 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
32 # Install nodejs and npm
33 ONBUILD ADD generated/node-v10.23.1-linux-arm64.tar.xz /usr/local/
34 ONBUILD RUN ln -s /usr/local/node-v10.23.1-linux-arm64/bin/* /usr/local/bin/
36 FROM build_${HOSTTYPE}
38 MAINTAINER Arvados Package Maintainers <packaging@arvados.org>
40 ENV DEBIAN_FRONTEND noninteractive
42 SHELL ["/bin/bash", "-c"]
43 # Install dependencies.
44 RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y python3 python3-pip libcurl4-gnutls-dev libgnutls28-dev curl git libattr1-dev libfuse-dev libpq-dev unzip tzdata python3-venv python3-dev libpam-dev shared-mime-info equivs
47 RUN /usr/bin/pip3 install 'virtualenv<20'
50 ADD generated/mpapis.asc /tmp/
51 ADD generated/pkuczynski.asc /tmp/
52 RUN gpg --import --no-tty /tmp/mpapis.asc && \
53 gpg --import --no-tty /tmp/pkuczynski.asc && \
54 curl -L https://get.rvm.io | bash -s stable && \
55 /usr/local/rvm/bin/rvm install 2.7 -j $(grep -c processor /proc/cpuinfo) && \
56 /usr/local/rvm/bin/rvm alias create default ruby-2.7 && \
57 echo "gem: --no-document" >> ~/.gemrc && \
58 /usr/local/rvm/bin/rvm-exec default gem install bundler --version 2.2.19 && \
59 /usr/local/rvm/bin/rvm-exec default gem install fpm --version 1.10.2
61 RUN /usr/local/rvm/bin/rvm-exec default bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
62 # Cf. https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/
63 ENV MAKE "make --jobs $(grep -c processor /proc/cpuinfo)"
65 # Preseed the go module cache and the ruby gems, using the currently checked
66 # out branch of the source tree. This avoids potential compatibility issues
67 # between the version of Ruby and certain gems.
68 RUN git clone --depth 1 git://git.arvados.org/arvados.git /tmp/arvados && \
70 if [[ -n "${BRANCH}" ]]; then git checkout ${BRANCH}; fi && \
71 cd /tmp/arvados/services/api && \
72 /usr/local/rvm/bin/rvm-exec default bundle install && \
73 cd /tmp/arvados/apps/workbench && \
74 /usr/local/rvm/bin/rvm-exec default bundle install && \
79 ENV WORKSPACE /arvados
80 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "ubuntu2004"]