Dockerfile 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # INSTRUCTIONS:
  2. # I was not able to build docker images on an isolated devserver because of
  3. # issues with proxy internet access. Use a public cloud or other Linux system.
  4. # (I used a Debian system after installing docker features, adding my user to
  5. # the docker and docker-registry groups, and logging out and back in to pick
  6. # those up.)
  7. #
  8. # Follow https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-with-a-personal-access-token-classic
  9. # to login with your GitHub credentials, as in
  10. #
  11. # $ docker login ghcr.io -u pdillinger
  12. #
  13. # and paste the limited-purpose GitHub token into the terminal.
  14. #
  15. # Then in the build_tools/ubuntu22_image directory, (bump minor version for
  16. # random docker file updates, major version tracks Ubuntu release)
  17. #
  18. # $ docker build -t ghcr.io/facebook/rocksdb_ubuntu:22.0
  19. # $ docker push ghcr.io/facebook/rocksdb_ubuntu:22.0
  20. #
  21. # Might need to change visibility to public through
  22. # https://github.com/orgs/facebook/packages/container/rocksdb_ubuntu/settings
  23. # or similar.
  24. # from official ubuntu 22.04
  25. FROM ubuntu:22.04
  26. # update system
  27. RUN apt-get update
  28. RUN apt-get upgrade -y
  29. # install basic tools
  30. RUN apt-get install -y vim wget curl
  31. # install tzdata noninteractive
  32. RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
  33. # install git and default compilers
  34. RUN apt-get install -y git gcc g++ clang clang-tools
  35. # install basic package
  36. RUN apt-get install -y lsb-release software-properties-common gnupg
  37. # install gflags, tbb
  38. RUN apt-get install -y libgflags-dev libtbb-dev
  39. # install compression libs
  40. RUN apt-get install -y libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
  41. # install cmake
  42. RUN apt-get install -y cmake
  43. RUN apt-get install -y libssl-dev
  44. # install clang-13
  45. WORKDIR /root
  46. RUN wget https://apt.llvm.org/llvm.sh
  47. RUN chmod +x llvm.sh
  48. RUN ./llvm.sh 13 all
  49. # There are incompatibilities between clang with -std=c++20 and libstdc++
  50. # provided by gcc, so we have to compile with clang-13 using -stdlib=libc++
  51. # and only one version of libc++ can be installed on the system at one time.
  52. # So to avoid confusion we remove unusable clang-14 also.
  53. RUN apt-get install libc++-13-dev libc++abi-13-dev
  54. RUN apt-get purge -y clang-14 && apt-get autoremove -y
  55. # install gcc-10 and more, default is 11
  56. RUN apt-get install -y gcc-10 g++-10
  57. RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
  58. RUN apt-get install -y gcc-13 g++-13
  59. # install apt-get install -y valgrind
  60. RUN apt-get install -y valgrind
  61. # install folly depencencies
  62. # Missing compatible libunwind: RUN apt-get install -y libgoogle-glog-dev
  63. # So instead install from source. This currently requires compiling with
  64. # -DGLOG_USE_GLOG_EXPORT
  65. RUN wget https://github.com/google/glog/archive/refs/tags/v0.7.1.tar.gz && tar xzf v0.7.1.tar.gz && cd glog-0.7.1/ && cmake -S . -B build -G "Unix Makefiles" && cmake --build build && cmake --build build --target install && cd .. && rm -rf v0.7.1.tar.gz glog-0.7.1
  66. # install openjdk 8
  67. RUN apt-get install -y openjdk-8-jdk
  68. ENV JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-amd64
  69. # install mingw
  70. RUN apt-get install -y mingw-w64
  71. # install gtest-parallel package
  72. RUN git clone --single-branch --branch master --depth 1 https://github.com/google/gtest-parallel.git ~/gtest-parallel
  73. ENV PATH $PATH:/root/gtest-parallel
  74. # install libprotobuf for fuzzers test
  75. RUN apt-get install -y ninja-build binutils liblzma-dev libz-dev pkg-config autoconf libtool
  76. RUN git clone --branch v1.0 https://github.com/google/libprotobuf-mutator.git ~/libprotobuf-mutator && cd ~/libprotobuf-mutator && git checkout ffd86a32874e5c08a143019aad1aaf0907294c9f && mkdir build && cd build && cmake .. -GNinja -DCMAKE_C_COMPILER=clang-13 -DCMAKE_CXX_COMPILER=clang++-13 -DCMAKE_BUILD_TYPE=Release -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON && ninja && ninja install
  77. ENV PKG_CONFIG_PATH /usr/local/OFF/:/root/libprotobuf-mutator/build/external.protobuf/lib/pkgconfig/
  78. ENV PROTOC_BIN /root/libprotobuf-mutator/build/external.protobuf/bin/protoc
  79. # install the latest google benchmark
  80. RUN git clone --depth 1 --branch v1.7.0 https://github.com/google/benchmark.git ~/benchmark && cd ~/benchmark && mkdir build && cd build && cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_GTEST_TESTS=0 && ninja && ninja install && cd ~ && rm -rf /root/benchmark
  81. # clean up
  82. RUN rm -rf /var/lib/apt/lists/*