Skip to content

Commit bc2f756

Browse files
committed
Simplify Dockerfile by removing dummy source file steps
1 parent 3302c86 commit bc2f756

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

Dockerfile

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
1-
FROM rust:1.76-slim as builder
1+
FROM rust:1.85-slim as builder
22

33
WORKDIR /app
44

5-
# Copy the manifest files
6-
COPY Cargo.toml ./
7-
8-
# Create a dummy source file to build dependencies
9-
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
10-
11-
# Build dependencies (this will be cached)
12-
RUN cargo build --release
13-
14-
# Remove the dummy source file
15-
RUN rm -rf src
5+
# Copy Cargo files for dependency caching
6+
COPY Cargo.toml Cargo.lock* ./
167

178
# Copy the actual source code
189
COPY src ./src
1910

20-
# Force a rebuild with the actual source code
21-
RUN touch src/main.rs
22-
2311
# Build the application
2412
RUN cargo build --release
2513

0 commit comments

Comments
 (0)