Update rust docker to account for regenerating lock file.
This commit is contained in:
parent
59c9d1d271
commit
e49a90cf9f
1 changed files with 8 additions and 6 deletions
|
|
@ -9,14 +9,16 @@ RUN apt-get update && apt-get install -y \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy Cargo files for dependency caching
|
# Copy ONLY Cargo.toml to resolve dependencies
|
||||||
COPY Cargo.toml Cargo.lock ./
|
COPY Cargo.toml ./
|
||||||
# Create a dummy src/main.rs for dependency build
|
|
||||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
|
||||||
RUN cargo build --release && rm src/main.rs
|
|
||||||
|
|
||||||
# Copy source code and build
|
# KEY CHANGE: Generate lock file and fetch dependencies inside the container
|
||||||
|
RUN cargo update && cargo fetch
|
||||||
|
|
||||||
|
# Now copy the rest of your source code
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
|
||||||
|
# Build the project using the pre-fetched dependencies
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# --- Stage 2: Final Image ---
|
# --- Stage 2: Final Image ---
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue