docker/Dockerfile.sapling-slblame
View source
31abc921# syntax=docker/dockerfile:1
31abc922# Grove: Build Sapling (sl) CLI binary for Linux x86_64
31abc923#
31abc924# Build: cd /path/to/sapling && docker build -f /path/to/grove/docker/Dockerfile.sapling-sl -t grove/sapling-sl .
31abc925#
31abc926# Requires grove/sapling-deps:latest (shared C++ deps).
31abc927# Rust-only rebuild takes ~10 min with cache mounts.
31abc928
31abc929# =============================================================================
31abc9210# Stage 1: Build sl binary
31abc9211# =============================================================================
31abc9212FROM grove/sapling-deps:latest AS builder
31abc9213
31abc9214COPY . /build
31abc9215
31abc9216RUN --mount=type=cache,target=/root/.cargo/registry \
31abc9217 --mount=type=cache,target=/tmp/fbcode_builder_getdeps-ZbuildZbuildZfbcode_builder-root/build/eden \
31abc9218 python3 build/fbcode_builder/getdeps.py --allow-system-packages \
31abc9219 build --no-deps --build-type MinSizeRel --src-dir=. eden \
31abc9220 --project-install-prefix eden:/
31abc9221
31abc9222RUN python3 build/fbcode_builder/getdeps.py --allow-system-packages \
31abc9223 fixup-dyn-deps --strip --src-dir=. eden \
31abc9224 /artifacts --project-install-prefix eden:/ \
31abc9225 --final-install-prefix /usr/local
31abc9226
31abc9227# =============================================================================
31abc9228# Stage 2: Minimal image with just the sl binary
31abc9229# =============================================================================
31abc9230FROM ubuntu:22.04
31abc9231
31abc9232RUN apt-get update && apt-get install -y \
31abc9233 ca-certificates \
31abc9234 libssl3 \
31abc9235 zlib1g \
31abc9236 libzstd1 \
31abc9237 liblz4-1 \
31abc9238 libsnappy1v5 \
31abc9239 libsodium23 \
31abc9240 libevent-2.1-7 \
31abc9241 libdouble-conversion3 \
31abc9242 libgflags2.2 \
31abc9243 libgoogle-glog0v5 \
31abc9244 libunwind8 \
31abc9245 libdwarf1 \
31abc9246 python3 \
31abc9247 && rm -rf /var/lib/apt/lists/*
31abc9248
31abc9249COPY --from=builder /artifacts/bin/hgmain /usr/local/bin/sl
31abc9250COPY --from=builder /artifacts/bin/mkscratch /usr/local/bin/mkscratch
31abc9251# ISL web UI
31abc9252COPY --from=builder /artifacts/ /usr/local/
31abc9253
31abc9254ENTRYPOINT ["/usr/local/bin/sl"]