| 31abc92 | | | 1 | # syntax=docker/dockerfile:1 |
| 31abc92 | | | 2 | # Grove: Build Sapling (sl) CLI binary for Linux x86_64 |
| 31abc92 | | | 3 | # |
| 31abc92 | | | 4 | # Build: cd /path/to/sapling && docker build -f /path/to/grove/docker/Dockerfile.sapling-sl -t grove/sapling-sl . |
| 31abc92 | | | 5 | # |
| 31abc92 | | | 6 | # Requires grove/sapling-deps:latest (shared C++ deps). |
| 31abc92 | | | 7 | # Rust-only rebuild takes ~10 min with cache mounts. |
| 31abc92 | | | 8 | |
| 31abc92 | | | 9 | # ============================================================================= |
| 31abc92 | | | 10 | # Stage 1: Build sl binary |
| 31abc92 | | | 11 | # ============================================================================= |
| 31abc92 | | | 12 | FROM grove/sapling-deps:latest AS builder |
| 31abc92 | | | 13 | |
| 31abc92 | | | 14 | COPY . /build |
| 31abc92 | | | 15 | |
| 31abc92 | | | 16 | RUN --mount=type=cache,target=/root/.cargo/registry \ |
| 31abc92 | | | 17 | --mount=type=cache,target=/tmp/fbcode_builder_getdeps-ZbuildZbuildZfbcode_builder-root/build/eden \ |
| 31abc92 | | | 18 | python3 build/fbcode_builder/getdeps.py --allow-system-packages \ |
| 31abc92 | | | 19 | build --no-deps --build-type MinSizeRel --src-dir=. eden \ |
| 31abc92 | | | 20 | --project-install-prefix eden:/ |
| 31abc92 | | | 21 | |
| 31abc92 | | | 22 | RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \ |
| 31abc92 | | | 23 | fixup-dyn-deps --strip --src-dir=. eden \ |
| 31abc92 | | | 24 | /artifacts --project-install-prefix eden:/ \ |
| 31abc92 | | | 25 | --final-install-prefix /usr/local |
| 31abc92 | | | 26 | |
| 31abc92 | | | 27 | # ============================================================================= |
| 31abc92 | | | 28 | # Stage 2: Minimal image with just the sl binary |
| 31abc92 | | | 29 | # ============================================================================= |
| 31abc92 | | | 30 | FROM ubuntu:22.04 |
| 31abc92 | | | 31 | |
| 31abc92 | | | 32 | RUN apt-get update && apt-get install -y \ |
| 31abc92 | | | 33 | ca-certificates \ |
| 31abc92 | | | 34 | libssl3 \ |
| 31abc92 | | | 35 | zlib1g \ |
| 31abc92 | | | 36 | libzstd1 \ |
| 31abc92 | | | 37 | liblz4-1 \ |
| 31abc92 | | | 38 | libsnappy1v5 \ |
| 31abc92 | | | 39 | libsodium23 \ |
| 31abc92 | | | 40 | libevent-2.1-7 \ |
| 31abc92 | | | 41 | libdouble-conversion3 \ |
| 31abc92 | | | 42 | libgflags2.2 \ |
| 31abc92 | | | 43 | libgoogle-glog0v5 \ |
| 31abc92 | | | 44 | libunwind8 \ |
| 31abc92 | | | 45 | libdwarf1 \ |
| 31abc92 | | | 46 | python3 \ |
| 31abc92 | | | 47 | && rm -rf /var/lib/apt/lists/* |
| 31abc92 | | | 48 | |
| 31abc92 | | | 49 | COPY --from=builder /artifacts/bin/hgmain /usr/local/bin/sl |
| 31abc92 | | | 50 | COPY --from=builder /artifacts/bin/mkscratch /usr/local/bin/mkscratch |
| 31abc92 | | | 51 | # ISL web UI |
| 31abc92 | | | 52 | COPY --from=builder /artifacts/ /usr/local/ |
| 31abc92 | | | 53 | |
| 31abc92 | | | 54 | ENTRYPOINT ["/usr/local/bin/sl"] |