feat(ping/rust): Add dummy main to allow for caching of built dependencies (#78)
This commit is contained in:
parent
ddb2e4bad2
commit
31a128833d
|
@ -4,7 +4,12 @@ WORKDIR /usr/src/testplan
|
|||
RUN apt-get update && apt-get install -y cmake protobuf-compiler
|
||||
|
||||
ARG PLAN_PATH="./"
|
||||
COPY ./plan/${PLAN_PATH} ./plan
|
||||
|
||||
RUN mkdir -p ./plan/src
|
||||
COPY ./plan/${PLAN_PATH}/src/main.rs ./plan/src/main.rs
|
||||
COPY ./plan/${PLAN_PATH}/Cargo.toml ./plan/Cargo.toml
|
||||
COPY ./plan/${PLAN_PATH}/Cargo.lock ./plan/Cargo.lock
|
||||
|
||||
RUN cd ./plan/ && cargo build # Initial build acts as a cache.
|
||||
|
||||
ARG GIT_TARGET=""
|
||||
|
@ -13,6 +18,9 @@ RUN if [ ! -z "${GIT_TARGET}" ]; then sed -i "s,^git.*,git = \"https://${GIT_TAR
|
|||
ARG GIT_REF=""
|
||||
RUN if [ "master" = "${GIT_REF}" ]; then sed -i "s/^rev.*/branch= \"master\"/" ./plan/Cargo.toml; elif [ ! -z "${GIT_REF}" ]; then sed -i "s/^rev.*/rev = \"${GIT_REF}\"/" ./plan/Cargo.toml; fi
|
||||
|
||||
COPY ./plan/${PLAN_PATH}/src/lib.rs ./plan/src/lib.rs
|
||||
COPY ./plan/${PLAN_PATH}/src/bin/ ./plan/src/bin/
|
||||
|
||||
# Build the requested binary: Cargo will update lockfile on changed manifest (i.e. if one of the above `sed`s patched it).
|
||||
ARG BINARY_NAME
|
||||
RUN cd ./plan/ \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("This is a dummy main file that is used for creating a cache layer inside the docker container.")
|
||||
}
|
Loading…
Reference in New Issue