kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/extractors/bazel/Dockerfile (about) 1 # Copyright 2020 The Kythe Authors. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 FROM debian:stable-slim 16 17 # Install C++ compilers and other deps 18 # note that openjdk-11-jdk-headless is a dependency of the java extractor 19 RUN apt-get update -y && \ 20 # This is temporary until Debian starts shipping merged /usr directories in their images 21 apt-mark hold usrmerge usr-is-merged && \ 22 apt-get upgrade -y && \ 23 apt-get install -y git clang-15 build-essential zip python3 openjdk-17-jdk-headless curl && \ 24 apt-get clean 25 26 # Create clang symlinks 27 RUN ln -s /usr/bin/clang-15 /usr/bin/clang && \ 28 ln -s /usr/bin/clang++-15 /usr/bin/clang++ 29 30 RUN echo 'build --client_env=CC=/usr/bin/clang' >> ~/.bazelrc 31 RUN echo 'build --client_env=CXX=/usr/bin/clang++' >> ~/.bazelrc 32 33 # Extract the Kythe release archive to /kythe 34 COPY kythe/release/kythe-v*.tar.gz /tmp/ 35 RUN tar --no-same-owner -xzf /tmp/kythe-v*.tar.gz && \ 36 mv kythe-v*/ /kythe && \ 37 rm /tmp/kythe-v*.tar.gz 38 39 # Tools and configuration 40 ADD kythe/extractors/bazel/extract.sh /kythe/ 41 ADD kythe/extractors/bazel/bazel_wrapper.sh /kythe/ 42 ADD kythe/release/base/fix_permissions.sh /kythe/ 43 44 # Fetch the latest version of Bazelisk for AMD64 Linux from GitHub 45 RUN curl -s https://api.github.com/repos/bazelbuild/bazelisk/releases/latest \ 46 | sed -n '/browser_download_url/s/[^:]*:[^"]*\("[^"]*"\).*/url = \1/p' \ 47 | grep bazelisk-linux-amd64 \ 48 | curl -L -o /kythe/bazelisk -K - \ 49 && chmod +x /kythe/bazelisk 50 51 RUN mkdir -p /workspace 52 WORKDIR /workspace 53 54 # copied from gcr.io bazel image 55 # Store the Bazel outputs under /workspace so that the symlinks under bazel-bin 56 # (et al) are accessible to downstream build steps. 57 RUN echo 'startup --output_base=/workspace/.bazel' >> ~/.bazelrc 58 59 ENTRYPOINT ["/kythe/extract.sh"]