Skip to content

Commit 5d2959e

Browse files
committed
Updated docker file for backend
1 parent 1477293 commit 5d2959e

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

backend/api/Dockerfile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ WORKDIR /app
66
# Copy Cargo files
77
COPY Cargo.toml Cargo.lock ./
88

9-
# Create dummy main.rs for caching (optional)
10-
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
9+
# Fetch dependencies without building the app
10+
RUN cargo fetch
1111

12-
# Build dependencies
13-
RUN cargo build --release
14-
15-
# Copy source code and sqlx metadata
12+
# Copy the source code and SQLx metadata
1613
COPY . .
17-
COPY .sqlx .
14+
COPY .sqlx .
1815

1916
# Enable offline mode for SQLx
2017
ENV SQLX_OFFLINE=true
@@ -34,10 +31,10 @@ RUN apt-get update && apt-get install -y \
3431
WORKDIR /app
3532

3633
# Copy the migrations folder to the runtime stage
37-
# COPY --from=builder /app/migrations ./migrations
34+
COPY --from=builder /app/migrations ./migrations
3835

3936
# Copy the binary
4037
COPY --from=builder /app/target/release/api .
4138

4239
EXPOSE 8000
43-
CMD ["./api"]
40+
CMD ["./api"]

0 commit comments

Comments
 (0)