1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
9 FROM ubuntu:jammy as build_x86_64
12 ONBUILD ADD generated/go${GOVERSION}.linux-amd64.tar.gz /usr/local/
13 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
14 # Install nodejs and npm
15 ONBUILD ADD generated/node-v10.23.1-linux-x64.tar.xz /usr/local/
16 ONBUILD RUN ln -s /usr/local/node-v10.23.1-linux-x64/bin/* /usr/local/bin/
17 # On x86, we want some cross-compilation support for arm64
18 # Add gcc-aarch64-linux-gnu to compile go binaries for arm64
19 ONBUILD RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y gcc-aarch64-linux-gnu
20 # We also need libpam compiled for arm64, and that requires some sources.list mangling
21 ONBUILD RUN /bin/sed -i 's/deb http/deb [ arch=amd64 ] http/' /etc/apt/sources.list
22 ONBUILD ADD ports.list /etc/apt/sources.list.d/
23 ONBUILD RUN /usr/bin/dpkg --add-architecture arm64
24 ONBUILD RUN /usr/bin/apt-get update && /usr/bin/apt-get install -o APT::Immediate-Configure=0 -q -y libpam0g-dev:arm64 libfuse-dev:arm64
26 FROM ubuntu:jammy as build_aarch64
29 ONBUILD ADD generated/go${GOVERSION}.linux-arm64.tar.gz /usr/local/
30 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
31 # Install nodejs and npm
32 ONBUILD ADD generated/node-v10.23.1-linux-arm64.tar.xz /usr/local/
33 ONBUILD RUN ln -s /usr/local/node-v10.23.1-linux-arm64/bin/* /usr/local/bin/
35 FROM build_${HOSTTYPE}
37 LABEL org.opencontainers.image.authors="Arvados Package Maintainers <packaging@arvados.org>"
39 ENV DEBIAN_FRONTEND noninteractive
41 SHELL ["/bin/bash", "-c"]
42 # Install dependencies.
43 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
46 RUN /usr/bin/pip3 install 'virtualenv<20'
49 ADD generated/mpapis.asc /tmp/
50 ADD generated/pkuczynski.asc /tmp/
51 RUN gpg --import --no-tty /tmp/mpapis.asc && \
52 gpg --import --no-tty /tmp/pkuczynski.asc && \
53 curl -L https://get.rvm.io | bash -s stable && \
54 # Use custom 1.1 openssl -- see: https://github.com/rvm/rvm/issues/5209#issuecomment-1114159447
55 /usr/local/rvm/bin/rvm pkg install openssl && \
56 /usr/local/rvm/bin/rvm install 2.7 --with-openssl-dir=/usr/local/rvm/usr -j $(grep -c processor /proc/cpuinfo) && \
57 /usr/local/rvm/bin/rvm alias create default ruby-2.7 && \
58 echo "gem: --no-document" >> ~/.gemrc && \
59 /usr/local/rvm/bin/rvm-exec default gem install bundler --version 2.2.19 && \
60 /usr/local/rvm/bin/rvm-exec default gem install fpm --version 1.10.2
62 RUN /usr/local/rvm/bin/rvm-exec default bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
63 # Cf. https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/
64 ENV MAKE "make --jobs $(grep -c processor /proc/cpuinfo)"
66 # Preseed the go module cache and the ruby gems, using the currently checked
67 # out branch of the source tree. This avoids potential compatibility issues
68 # between the version of Ruby and certain gems.
69 RUN git clone --depth 1 git://git.arvados.org/arvados.git /tmp/arvados && \
71 if [[ -n "${BRANCH}" ]]; then git checkout ${BRANCH}; fi && \
72 cd /tmp/arvados/services/api && \
73 /usr/local/rvm/bin/rvm-exec default bundle install && \
74 cd /tmp/arvados/apps/workbench && \
75 /usr/local/rvm/bin/rvm-exec default bundle install && \
80 ENV WORKSPACE /arvados
81 CMD ["/usr/local/rvm/bin/rvm-exec", "default", "bash", "/jenkins/run-build-packages.sh", "--target", "ubuntu2204"]