Copy cache crate

This commit is contained in:
Valentin Brandl 2019-08-07 22:24:20 +02:00
parent 501257684e
commit d97e392a93
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -17,17 +17,21 @@ RUN ./build.sh
FROM ekidd/rust-musl-builder:stable as backend
# create new cargo project
RUN USER=rust cargo init --bin
RUN USER=rust cargo new --bin gitache
RUN cargo new --lib time-cache
WORKDIR /home/rust/src/gitache
# copy build config
COPY --chown=rust ./backend/Cargo.lock ./Cargo.lock
COPY --chown=rust ./backend/Cargo.toml ./Cargo.toml
COPY --chown=rust ./backend/Cargo.lock ./gitache/Cargo.lock
COPY --chown=rust ./backend/Cargo.toml ./gitache/Cargo.toml
COPY --chown=rust ./time-cache/Cargo.toml ./time-cache/Cargo.toml
# build to cache dependencies
RUN cargo build --release
# delete build cache to prevent caching issues later on
RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/gitache-*
COPY ./backend/static ./static
COPY ./backend/src ./src
COPY ./backend/static ./gitache/static
COPY ./backend/src ./gitache/src
COPY ./time-cache/src ./time-cache/src
# build source code
RUN cargo build --release
@ -43,7 +47,7 @@ COPY --from=linuxkit/ca-certificates:v0.7 / /
COPY --from=user_builder /etc/passwd /etc/passwd
USER dummy
COPY --from=backend /home/rust/src/target/x86_64-unknown-linux-musl/release/gitache /
COPY --from=backend /home/rust/src/gitache/target/x86_64-unknown-linux-musl/release/gitache /
COPY --from=frontend /output/index.html /public/index.html
COPY --from=frontend /output/scripts /public/scripts
COPY --from=frontend /output/assets /public/assets