File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -17,24 +17,17 @@ CARGO:
17
17
RUN --mount = type= cache,mode= 0777,sharing= shared,target= $CARGO_HOME /registry \
18
18
--mount = type= cache,mode= 0777,sharing= shared,target= $CARGO_HOME /git \
19
19
--mount = type= cache,mode= 0777,target= target \
20
- cargo $args ;
20
+ cargo $args ; \
21
+ if [ -n "$output" ]; then \
22
+ mkdir /earthly_lib_rust_temp; \
23
+ cd target; \
24
+ find . -type f -regextype posix-egrep -regex "./$output" -exec cp --parents \{\} /earthly_lib_rust_temp \; ; \
25
+ fi
21
26
IF [ "$output" != "" ]
22
- DO +COPY_FROM_TARGET_CACHE --regex = $output
27
+ RUN mkdir -p target; \
28
+ mv /earthly_lib_rust_temp/* target 2> /dev/null || echo "no files found within ./target matching the provided output regexp" ;
23
29
END
24
30
25
- # COPY_FROM_TARGET_CACHE copies the files matching the regex from the target cache to the caller filesystem (image layers).
26
- COPY_FROM_TARGET_CACHE :
27
- COMMAND
28
- ARG regex
29
- RUN --no-cache --mount = type= cache,mode= 0777,target= target \
30
- mkdir earthly_lib_rust_temp; \
31
- cd target; \
32
- find . -regextype posix-egrep -regex "./$regex" -exec cp --parents \{\} ../earthly_lib_rust_temp \; ; \
33
- cd ..; \
34
- echo "Copied output: $(du -hs earthly_lib_rust_temp | awk '{print $1}')" ;
35
- RUN mkdir -p target; \
36
- mv earthly_lib_rust_temp/* target;
37
-
38
31
# REMOVE_SOURCE_FINGERPRINTS removes the Cargo fingerprint folders of the source packages.
39
32
# This guarantees Cargo compiles the packages when COPY commands of the source folders have a static timestamp (see --keep-ts)
40
33
REMOVE_SOURCE_FINGERPRINTS :
You can’t perform that action at this time.
0 commit comments