Update Docker build
Do not cache build dependencies
This commit is contained in:
parent
3168b7e403
commit
74ce296310
10
Dockerfile
10
Dockerfile
@ -3,15 +3,21 @@ FROM ekidd/rust-musl-builder:stable as builder
|
|||||||
# create new cargo project
|
# create new cargo project
|
||||||
RUN USER=rust cargo init --bin
|
RUN USER=rust cargo init --bin
|
||||||
# copy build config
|
# copy build config
|
||||||
COPY ./Cargo.lock ./Cargo.lock
|
COPY --chown=rust ./Cargo.lock ./Cargo.lock
|
||||||
COPY ./Cargo.toml ./Cargo.toml
|
COPY ./Cargo.toml ./Cargo.toml
|
||||||
|
# HACK: remove build-dependencies so we have at least some caching
|
||||||
|
RUN head -n $(($(grep -n "\[build-dependencies\]" Cargo.toml | cut -f1 -d:) - 1)) Cargo.toml | sed '/build.rs/d' > \
|
||||||
|
Cargo.toml2 && rm Cargo.toml && mv Cargo.toml2 Cargo.toml
|
||||||
# build to cache dependencies
|
# build to cache dependencies
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
# delete build cache to prevent caching issues later on
|
# delete build cache to prevent caching issues later on
|
||||||
RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/hoc-*
|
RUN rm -r ./target/x86_64-unknown-linux-musl/release/.fingerprint/hoc-*
|
||||||
|
|
||||||
# copy source code
|
# copy original Cargo.toml (HACK)
|
||||||
|
COPY ./Cargo.toml ./Cargo.toml
|
||||||
|
# we need our git folder so we can determine the commitref of HEAD
|
||||||
COPY ./.git ./.git
|
COPY ./.git ./.git
|
||||||
|
# copy source code
|
||||||
COPY ./static ./static
|
COPY ./static ./static
|
||||||
COPY ./templates ./templates
|
COPY ./templates ./templates
|
||||||
COPY ./build.rs ./build.rs
|
COPY ./build.rs ./build.rs
|
||||||
|
Loading…
Reference in New Issue
Block a user