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