chore: Add Dockerfile.dev for local development (#8295)

Currently whenever we build the `Dockerfile` file for local development using kurtosis , it recompiles everything on my laptop, even if no changes are made.  This takes about 120 seconds on my laptop (might be faster on others).


  Conservatively, I created a new Dockerfile.dev, so that the original file is kept the same, even though its pretty similar.

This uses `--mount-type=cache` saving the target and registry folder across builds.

**Usage**

```sh
docker build -f Dockerfile.dev -t lighthouse:dev .
```


Co-Authored-By: Kevaundray Wedderburn <kevtheappdev@gmail.com>
This commit is contained in:
kevaundray
2025-11-24 02:40:20 -03:00
committed by GitHub
parent 0d0232e8fc
commit 03832b0ad2

25
Dockerfile.dev Normal file
View File

@@ -0,0 +1,25 @@
FROM rust:1.88.0-bullseye AS builder
RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev
WORKDIR /lighthouse
ARG FEATURES
ARG PROFILE=release
ARG CARGO_USE_GIT_CLI=true
ENV FEATURES=$FEATURES
ENV PROFILE=$PROFILE
ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_USE_GIT_CLI
ENV CARGO_INCREMENTAL=1
COPY . .
# Persist the registry and target file across builds. See: https://docs.docker.com/build/cache/optimize/#use-cache-mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/lighthouse/target \
make
FROM ubuntu:22.04
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
libssl-dev \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse