Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. FROM ubuntu:22.04 as carbon-ubuntu2204-base
  5. # Install apt tools:
  6. # git: Used by VS Code.
  7. # golang: Used for Bazelisk and Buildifier.
  8. # python3: For Carbon tools.
  9. # gnupg, software-properties-common, wget: For llvm.sh.
  10. # apt-get update and install together per Docker best practice.
  11. RUN apt-get update && \
  12. apt-get install -y \
  13. git \
  14. gnupg \
  15. golang \
  16. python3-pip \
  17. python3.9 \
  18. software-properties-common \
  19. wget
  20. ENV PATH="/root/go/bin:${PATH}"
  21. # Bazelisk is used for Carbon builds.
  22. RUN go install github.com/bazelbuild/bazelisk@v1.14.0
  23. RUN ln -s /root/go/bin/bazelisk /root/go/bin/bazel
  24. # Buildifier is used by the Bazel VS Code extension.
  25. RUN go install github.com/bazelbuild/buildtools/buildifier@5.1.0
  26. # Install LLVM from apt.llvm.org.
  27. RUN wget https://apt.llvm.org/llvm.sh
  28. RUN chmod +x llvm.sh
  29. RUN ./llvm.sh 15 all
  30. RUN rm llvm.sh
  31. # Add the lib dir to the PATH. This helps Bazel find clang and VS Code find
  32. # clangd, without version suffixes.
  33. ENV PATH="/usr/lib/llvm-15/bin:${PATH}"
  34. # Update pip and install black and pre-commit.
  35. RUN pip3 install -U pip
  36. RUN pip3 install black pre-commit