762e4d2335859263d920fb3864187a1adac32728
[arvados.git] / build / package-build-dockerfiles / debian11 / 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 ARG GOVERSION
8
9 FROM debian:bullseye as build_x86_64
10 # Install go
11 ONBUILD ARG BRANCH
12 ONBUILD ARG GOVERSION
13 ONBUILD ADD generated/go${GOVERSION}.linux-amd64.tar.gz /usr/local/
14 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
15 # Install nodejs and npm
16 ONBUILD ADD generated/node-v12.22.12-linux-x64.tar.xz /usr/local/
17 ONBUILD RUN ln -s /usr/local/node-v12.22.12-linux-x64/bin/* /usr/local/bin/
18 ONBUILD RUN npm install -g yarn
19 ONBUILD RUN ln -sf /usr/local/node-v12.22.12-linux-x64/bin/* /usr/local/bin/
20 # On x86, we want some cross-compilation support for arm64
21 # Add gcc-aarch64-linux-gnu to compile go binaries for arm64
22 ONBUILD RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y gcc-aarch64-linux-gnu
23 # We also need libpam compiled for arm64
24 ONBUILD RUN /usr/bin/dpkg --add-architecture arm64
25 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
27 FROM debian:bullseye as build_aarch64
28 # Install go
29 ONBUILD ARG BRANCH
30 ONBUILD ARG GOVERSION
31 ONBUILD ADD generated/go${GOVERSION}.linux-arm64.tar.gz /usr/local/
32 ONBUILD RUN ln -s /usr/local/go/bin/go /usr/local/bin/
33 # Install nodejs and npm
34 ONBUILD ADD generated/node-v12.22.12-linux-arm64.tar.xz /usr/local/
35 ONBUILD RUN ln -s /usr/local/node-v12.22.12-linux-arm64/bin/* /usr/local/bin/
36 ONBUILD RUN npm install -g yarn
37 ONBUILD RUN ln -sf /usr/local/node-v12.22.12-linux-arm64/bin/* /usr/local/bin/
38
39 FROM build_${HOSTTYPE}
40 RUN echo HOSTTYPE ${HOSTTYPE}
41
42 MAINTAINER Arvados Package Maintainers <packaging@arvados.org>
43
44 ENV DEBIAN_FRONTEND noninteractive
45
46 SHELL ["/bin/bash", "-c"]
47 # Install dependencies.
48 RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y \
49     build-essential \
50     curl \
51     equivs \
52     git \
53     libattr1-dev \
54     libcurl4-gnutls-dev \
55     libfuse-dev \
56     libgnutls28-dev \
57     libpam-dev \
58     libpq-dev \
59     pkgconf \
60     procps \
61     python3 \
62     python3-dev \
63     python3-venv \
64     ruby \
65     ruby-dev \
66     unzip
67
68 # fpm depends on dotenv, but version 3.0 of that gem dropped support for
69 # Ruby 2.7, so we need to specifically install an older version.
70 RUN echo "gem: --no-document" >> ~/.gemrc && \
71     gem install bundler --version 2.2.19 && \
72     gem install dotenv --version '~> 2.8' && \
73     gem install fpm --version 1.15.1 && \
74     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
75
76 # Cf. https://build.betterup.com/one-weird-trick-that-will-speed-up-your-bundle-install/
77 ENV MAKE "make --jobs $(grep -c processor /proc/cpuinfo)"
78
79 # Preseed the go module cache and the ruby gems, using the currently checked
80 # out branch of the source tree. This avoids potential compatibility issues
81 # between the version of Ruby and certain gems.
82 RUN git clone git://git.arvados.org/arvados.git /tmp/arvados && \
83     cd /tmp/arvados && \
84     if [[ -n "${BRANCH}" ]]; then git checkout ${BRANCH}; fi && \
85     cd /tmp/arvados/services/api && \
86     bundle install && \
87     cd /tmp/arvados && \
88     go mod download
89
90 ENV WORKSPACE /arvados
91 CMD ["bash", "/jenkins/run-build-packages.sh", "--target", "debian11"]