Dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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:24.04 as carbon-ubuntu2404-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 \
  18. software-properties-common \
  19. wget \
  20. nodejs \
  21. npm
  22. ENV PATH="/root/go/bin:${PATH}"
  23. # Bazelisk is used for Carbon builds.
  24. RUN go install github.com/bazelbuild/bazelisk@v1.14.0
  25. RUN ln -s /root/go/bin/bazelisk /root/go/bin/bazel
  26. # Buildifier is used by the Bazel VS Code extension.
  27. RUN go install github.com/bazelbuild/buildtools/buildifier@5.1.0
  28. # Install LLVM from apt.llvm.org.
  29. RUN wget https://apt.llvm.org/llvm.sh
  30. RUN chmod +x llvm.sh
  31. RUN ./llvm.sh 18 all
  32. RUN rm llvm.sh
  33. # Add the lib dir to the PATH. This helps Bazel find clang and VS Code find
  34. # clangd, without version suffixes.
  35. ENV PATH="/usr/lib/llvm-18/bin:${PATH}"
  36. # Update pip and install black and pre-commit.
  37. RUN pip3 install black pre-commit --break-system-packages
  38. # Create .cache directory with proper ownership. We will mount a named volume
  39. # at this location to allow caching of bazel build files.
  40. RUN mkdir /home/ubuntu/.cache && chown -R ubuntu:ubuntu /home/ubuntu/.cache