7.6 KB181 lines
Blame
1# syntax=docker/dockerfile:1
2# Grove: Shared C++ dependency base image for Mononoke and EdenFS
3#
4# Build: cd /build/sapling && docker build -f /build/grove/docker/Dockerfile.sapling-deps -t grove/sapling-deps .
5#
6# This image contains all the heavy C++ dependencies (folly, fbthrift, etc.)
7# and Rust toolchain shared by both Mononoke and EdenFS. Building it once
8# saves ~200GB of duplicated Docker build cache and halves cold build time.
9#
10# Rebuild only when build/fbcode_builder manifests change.
11
12FROM ubuntu:22.04
13
14ENV DEBIAN_FRONTEND=noninteractive
15
16# Install system dependencies — superset of both Mononoke and EdenFS needs.
17# EdenFS-specific packages: libfuse-dev, libclang-dev, libre2-dev, libgit2-dev,
18# liblmdb-dev, libsqlite3-dev, libcurl4-openssl-dev, libnghttp2-dev, python3-dev
19RUN apt-get update && apt-get install -y \
20 python3 python3-dev python3-pip python-is-python3 \
21 curl wget git \
22 build-essential g++ gcc cmake ninja-build \
23 autoconf automake libtool pkg-config \
24 libssl-dev zlib1g-dev libzstd-dev liblz4-dev libsnappy-dev \
25 libboost-all-dev libdouble-conversion-dev libgflags-dev libgoogle-glog-dev \
26 libevent-dev libsodium-dev libdwarf-dev \
27 libaio-dev libiberty-dev libunwind-dev liblzma-dev \
28 bison flex \
29 libfuse-dev \
30 libclang-dev clang \
31 libre2-dev \
32 libgit2-dev \
33 liblmdb-dev \
34 libsqlite3-dev sqlite3 \
35 libcurl4-openssl-dev \
36 libnghttp2-dev \
37 libffi-dev \
38 && rm -rf /var/lib/apt/lists/*
39
40WORKDIR /build
41
42# Copy ONLY the build system (manifests, patches, scripts).
43# This layer won't change when project source is modified,
44# so all C++ dep layers below stay cached.
45COPY build/fbcode_builder build/fbcode_builder
46COPY CMake CMake
47COPY CMakeLists.txt CMakeLists.txt
48
49# Install system deps via getdeps (eden is the superset)
50RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
51 install-system-deps --recursive eden || true
52
53# ---- Third-party C++ libraries (shared by both projects) ----
54
55RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
56 build --build-type MinSizeRel --free-up-disk --no-tests xxhash || true
57
58RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
59 build --build-type MinSizeRel --free-up-disk --no-tests openssl || true
60
61RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
62 build --build-type MinSizeRel --free-up-disk --no-tests fmt
63
64RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
65 build --build-type MinSizeRel --free-up-disk --no-tests googletest
66
67RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
68 build --build-type MinSizeRel --free-up-disk --no-tests zstd || true
69
70RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
71 build --build-type MinSizeRel --free-up-disk --no-tests boost || true
72
73RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
74 build --build-type MinSizeRel --free-up-disk --no-tests double-conversion || true
75
76RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
77 build --build-type MinSizeRel --free-up-disk --no-tests fast_float
78
79RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
80 build --build-type MinSizeRel --free-up-disk --no-tests gflags || true
81
82RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
83 build --build-type MinSizeRel --free-up-disk --no-tests glog || true
84
85RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
86 build --build-type MinSizeRel --free-up-disk --no-tests libaio || true
87
88RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
89 build --build-type MinSizeRel --free-up-disk --no-tests libdwarf || true
90
91RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
92 build --build-type MinSizeRel --free-up-disk --no-tests libevent || true
93
94RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
95 build --build-type MinSizeRel --free-up-disk --no-tests lz4 || true
96
97RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
98 build --build-type MinSizeRel --free-up-disk --no-tests snappy || true
99
100RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
101 build --build-type MinSizeRel --free-up-disk --no-tests zlib || true
102
103RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
104 build --build-type MinSizeRel --free-up-disk --no-tests liboqs || true
105
106RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
107 build --build-type MinSizeRel --free-up-disk --no-tests autoconf || true
108
109RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
110 build --build-type MinSizeRel --free-up-disk --no-tests automake || true
111
112RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
113 build --build-type MinSizeRel --free-up-disk --no-tests libtool || true
114
115RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
116 build --build-type MinSizeRel --free-up-disk --no-tests libsodium || true
117
118RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
119 build --build-type MinSizeRel --free-up-disk --no-tests libiberty || true
120
121RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
122 build --build-type MinSizeRel --free-up-disk --no-tests libunwind || true
123
124RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
125 build --build-type MinSizeRel --free-up-disk --no-tests xz || true
126
127# ---- Facebook C++ libraries (order matters) ----
128
129RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
130 build --build-type MinSizeRel --free-up-disk --no-tests folly
131
132RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
133 build --build-type MinSizeRel --free-up-disk --no-tests fizz
134
135RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
136 build --build-type MinSizeRel --free-up-disk --no-tests mvfst
137
138RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
139 build --build-type MinSizeRel --free-up-disk --no-tests wangle
140
141RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
142 build --build-type MinSizeRel --free-up-disk --no-tests fbthrift
143
144RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
145 build --build-type MinSizeRel --free-up-disk --no-tests fb303
146
147# ---- Rust toolchain + rust-shed ----
148
149RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.91
150ENV PATH="/root/.cargo/bin:${PATH}"
151
152RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
153 build --build-type MinSizeRel --free-up-disk --no-tests rust-shed
154
155# ---- EdenFS-specific C++ deps (also included so EdenFS doesn't need to rebuild) ----
156
157RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
158 build --build-type MinSizeRel --free-up-disk --no-tests blake3
159
160RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
161 build --build-type MinSizeRel --free-up-disk --no-tests cpptoml
162
163RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
164 build --build-type MinSizeRel --free-up-disk --no-tests rocksdb
165
166RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
167 build --build-type MinSizeRel --free-up-disk --no-tests edencommon
168
169# Python deps required by EdenFS CMake
170RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
171 build --no-tests python-toml
172
173RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
174 build --no-tests python-filelock
175
176RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
177 build --no-tests python-psutil
178
179RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
180 build --no-tests pexpect || true
181