@@ -50,29 +50,34 @@ ENV CFG_RELEASE_CHANNEL=nightly
50
50
# create app directory
51
51
WORKDIR /usr/src/elasticsearch-rs
52
52
53
- # copy just the Cargo.toml (and certs), and create a "fake" [lib/main].rs so that Docker caches all package dependencies
53
+ # copy just enough to build dependencies
54
54
COPY .ci/certs ./.ci/certs
55
55
COPY Cargo.toml ./Cargo.toml
56
56
COPY README.md ./README.md
57
- COPY elasticsearch/Cargo.toml ./elasticsearch/
58
- COPY api_generator/Cargo.toml ./api_generator/
59
- COPY yaml_test_runner/Cargo.toml ./yaml_test_runner/
57
+ COPY elasticsearch/Cargo.toml ./elasticsearch/Cargo.toml
58
+ COPY api_generator/Cargo.toml ./api_generator/Cargo.toml
59
+ COPY yaml_test_runner/Cargo.toml ./yaml_test_runner/Cargo.toml
60
60
61
+ # cache dependencies
61
62
RUN mkdir -p elasticsearch/src; \
62
63
echo "// dummy file" > elasticsearch/src/lib.rs; \
63
64
mkdir -p api_generator/src; \
64
65
echo "// dummy file" > api_generator/src/lib.rs; \
65
66
mkdir -p yaml_test_runner/src; \
66
67
echo "// dummy file" > yaml_test_runner/src/main.rs; \
67
- cargo build --tests
68
+ cargo build --tests; \
69
+ rm elasticsearch/src/lib.rs; \
70
+ rm api_generator/src/lib.rs; \
71
+ rm yaml_test_runner/src/main.rs;
68
72
69
- # install app dependencies and build
70
- COPY elasticsearch ./elasticsearch
73
+ # copy all source
74
+ COPY elasticsearch/src ./elasticsearch/src
75
+ COPY elasticsearch/build.rs ./elasticsearch/build.rs
71
76
COPY api_generator ./api_generator
72
77
COPY yaml_test_runner ./yaml_test_runner
73
78
74
- # Run cargo build separately on packages. Running cargo build at the workspace level fails for the api_generator/bin/run.rs
75
- # This may be related to the caching hack above. TODO: Investigate
76
- RUN cargo build -p api_generator ; \
77
- cargo build -p elasticsearch ; \
78
- cargo build -p yaml_test_runner
79
+ # build
80
+ RUN rm ./target/debug/deps/api_generator*; \
81
+ rm ./target/debug/deps/elasticsearch* ; \
82
+ rm ./target/debug/deps/yaml_test_runner* ; \
83
+ cargo build --tests;
0 commit comments