Provide dummy main file to get through dependency validation then pass source files in to take advantage of github action caching to significantly speed up pushes.

This commit is contained in:
Christbru 2025-10-18 18:59:55 -05:00
commit 066bab50ba

View file

@ -9,12 +9,18 @@ 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 ONLY Cargo.toml to resolve dependencies # Copy ONLY Cargo.toml
COPY Cargo.toml ./ COPY Cargo.toml ./
# KEY CHANGE: Generate lock file and fetch dependencies inside the container # --- KEY CHANGE: Create a dummy main.rs BEFORE fetching dependencies ---
RUN mkdir src && echo "fn main() {}" > src/main.rs
# Now, generate the lock file and fetch dependencies
RUN cargo update && cargo fetch RUN cargo update && cargo fetch
# Remove the dummy file before copying the real source code
RUN rm -rf src
# Now copy the rest of your source code # Now copy the rest of your source code
COPY src ./src COPY src ./src