Skip to content

Commit 64e5a45

Browse files
committed
update Dockerfile to use caches
1 parent 33c8cc1 commit 64e5a45

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
FROM rust:1.88.0-bullseye AS builder
22
RUN apt-get update && apt-get -y upgrade && apt-get install -y cmake libclang-dev
3-
COPY . lighthouse
3+
WORKDIR /lighthouse
4+
45
ARG FEATURES
56
ARG PROFILE=release
67
ARG CARGO_USE_GIT_CLI=true
78
ENV FEATURES=$FEATURES
89
ENV PROFILE=$PROFILE
910
ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_USE_GIT_CLI
10-
RUN cd lighthouse && make
11+
ENV CARGO_INCREMENTAL=1
12+
13+
COPY . .
14+
# Persist the registry and target file across builds. See: https://docs.docker.com/build/cache/optimize/#use-cache-mounts
15+
RUN --mount=type=cache,target=/usr/local/cargo/registry \
16+
--mount=type=cache,target=/lighthouse/target \
17+
make
1118

1219
FROM ubuntu:22.04
1320
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
1421
libssl-dev \
1522
ca-certificates \
1623
&& apt-get clean \
1724
&& rm -rf /var/lib/apt/lists/*
18-
COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse
25+
COPY --from=builder /usr/local/cargo/bin/lighthouse /usr/local/bin/lighthouse

0 commit comments

Comments
 (0)