1# Licensed to the Apache Software Foundation (ASF) under one 2# or more contributor license agreements. See the NOTICE file 3# distributed with this work for additional information 4# regarding copyright ownership. The ASF licenses this file 5# to you under the Apache License, Version 2.0 (the 6# "License"); you may not use this file except in compliance 7# with the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, 12# software distributed under the License is distributed on an 13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14# KIND, either express or implied. See the License for the 15# specific language governing permissions and limitations 16# under the License. 17 18ARG base 19FROM hadolint/hadolint:v1.17.2 AS hadolint 20FROM ${base} 21 22ARG clang_tools 23RUN apt-get update && \ 24 apt-get install -y -q \ 25 clang-${clang_tools} \ 26 clang-format-${clang_tools} \ 27 clang-tidy-${clang_tools} \ 28 clang-tools-${clang_tools} \ 29 cmake \ 30 curl \ 31 libclang-${clang_tools}-dev \ 32 llvm-${clang_tools}-dev \ 33 openjdk-11-jdk-headless \ 34 python3 \ 35 python3-dev \ 36 python3-pip \ 37 ruby \ 38 apt-transport-https \ 39 software-properties-common \ 40 && apt-get clean \ 41 && rm -rf /var/lib/apt/lists/* 42 43ARG r=4.1 44RUN apt-key adv \ 45 --keyserver keyserver.ubuntu.com \ 46 --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 && \ 47 # NOTE: R 3.5 and 3.6 are available in the repos with -cran35 suffix 48 # for trusty, xenial, bionic, and eoan (as of May 2020) 49 # -cran40 has 4.0 versions for bionic and focal 50 # R 3.2, 3.3, 3.4 are available without the suffix but only for trusty and xenial 51 # TODO: make sure OS version and R version are valid together and conditionally set repo suffix 52 # This is a hack to turn 3.6 into 35, and 4.0/4.1 into 40: 53 add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu '$(lsb_release -cs)'-cran'$(echo "${r}" | tr -d . | tr 6 5 | tr 1 0)'/' && \ 54 apt-get install -y \ 55 r-base=${r}* \ 56 r-recommended=${r}* \ 57 libxml2-dev 58 59# Ensure parallel R package installation, set CRAN repo mirror, 60# and use pre-built binaries where possible 61COPY ci/etc/rprofile /arrow/ci/etc/ 62RUN cat /arrow/ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site 63# Also ensure parallel compilation of C/C++ code 64RUN echo "MAKEFLAGS=-j$(R -s -e 'cat(parallel::detectCores())')" >> $(R RHOME)/etc/Renviron.site 65 66 67COPY ci/scripts/r_deps.sh /arrow/ci/scripts/ 68COPY r/DESCRIPTION /arrow/r/ 69# We need to install Arrow's dependencies in order for lintr's namespace searching to work. 70# This could be removed if lintr no longer loads the dependency namespaces (see issues/PRs below) 71RUN /arrow/ci/scripts/r_deps.sh /arrow 72# This fork has a number of changes that have PRs and Issues to resolve upstream: 73# https://github.com/jimhester/lintr/pull/843 74# https://github.com/jimhester/lintr/pull/841 75# https://github.com/jimhester/lintr/pull/845 76# https://github.com/jimhester/lintr/issues/842 77# https://github.com/jimhester/lintr/issues/846 78RUN R -e "remotes::install_github('jonkeane/lintr@arrow-branch')" 79 80# Docker linter 81COPY --from=hadolint /bin/hadolint /usr/bin/hadolint 82 83# IWYU 84COPY ci/scripts/install_iwyu.sh /arrow/ci/scripts/ 85RUN arrow/ci/scripts/install_iwyu.sh /tmp/iwyu /usr/local ${clang_tools} 86 87# Use python3 by default in scripts 88RUN ln -s /usr/bin/python3 /usr/local/bin/python && \ 89 ln -s /usr/bin/pip3 /usr/local/bin/pip 90 91COPY dev/archery/setup.py /arrow/dev/archery/ 92RUN pip install -e arrow/dev/archery[lint] 93 94ENV LC_ALL=C.UTF-8 \ 95 LANG=C.UTF-8 96