mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Merge pull request #127 from shekhirin/docker-deps-cache
chore(ci): cache dependencies in Docker build
This commit is contained in:
commit
b0956c09c1
15
Dockerfile
15
Dockerfile
@ -9,10 +9,23 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|||||||
|
|
||||||
WORKDIR /meilisearch
|
WORKDIR /meilisearch
|
||||||
|
|
||||||
COPY . .
|
COPY Cargo.lock .
|
||||||
|
COPY Cargo.toml .
|
||||||
|
|
||||||
|
COPY meilisearch-error/Cargo.toml meilisearch-error/
|
||||||
|
COPY meilisearch-http/Cargo.lock meilisearch-http/
|
||||||
|
COPY meilisearch-http/Cargo.toml meilisearch-http/
|
||||||
|
|
||||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
|
|
||||||
|
# Create dummy main.rs files for each workspace member to be able to compile all the dependencies
|
||||||
|
RUN find . -type d -name "meilisearch-*" | xargs -I{} sh -c 'mkdir {}/src; echo "fn main() { }" > {}/src/main.rs;'
|
||||||
|
# Use `cargo build` instead of `cargo vendor` because we need to not only download but compile dependencies too
|
||||||
|
RUN $HOME/.cargo/bin/cargo build --release
|
||||||
|
# Cleanup dummy main.rs files
|
||||||
|
RUN find . -path "*/src/main.rs" -delete
|
||||||
|
|
||||||
|
COPY . .
|
||||||
RUN $HOME/.cargo/bin/cargo build --release
|
RUN $HOME/.cargo/bin/cargo build --release
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
|
Loading…
Reference in New Issue
Block a user