Skip to content

Commit

Permalink
Dockerfile: copy all lib crates before fetching dependencies (linkerd…
Browse files Browse the repository at this point in the history
…#143)

Signed-off-by: Sean McArthur <sean@buoyant.io>
  • Loading branch information
seanmonstar committed Nov 28, 2018
1 parent 88340ca commit edd124f
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,12 @@ FROM $RUST_IMAGE as build
WORKDIR /usr/src/linkerd2-proxy

# Fetch external dependencies.
#
# Mock out all local code and fetch external dependencies to ensure that
# external sources are primarily cached on Cargo.lock.
RUN mkdir -p src && touch src/lib.rs && \
for d in fs-watch futures-mpsc-lossy metrics router stack task timeout never; \
do mkdir -p "lib/${d}/src" && touch "lib/${d}/src/lib.rs" ; \
done
RUN mkdir -p src && touch src/lib.rs
COPY Cargo.toml Cargo.lock ./
COPY lib/fs-watch/Cargo.toml lib/fs-watch/Cargo.toml
COPY lib/futures-mpsc-lossy/Cargo.toml lib/futures-mpsc-lossy/Cargo.toml
COPY lib/metrics/Cargo.toml lib/metrics/Cargo.toml
COPY lib/router/Cargo.toml lib/router/Cargo.toml
COPY lib/stack/Cargo.toml lib/stack/Cargo.toml
COPY lib/task/Cargo.toml lib/task/Cargo.toml
COPY lib/timeout/Cargo.toml lib/timeout/Cargo.toml
COPY lib/never/Cargo.toml lib/never/Cargo.toml
COPY lib lib
RUN cargo fetch --locked

# Build libraries, leaving the proxy mocked out.
COPY lib lib
ARG PROXY_UNOPTIMIZED
RUN if [ -n "$PROXY_UNOPTIMIZED" ]; \
then cargo build --frozen ; \
Expand Down

0 comments on commit edd124f

Please sign in to comment.