mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
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>
25 lines
844 B
Docker
25 lines
844 B
Docker
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 |