amaye15 commited on
Commit
9f77366
·
verified ·
1 Parent(s): dde124b

CI: Sync tiny-only from GitHub c017b2b

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -2
Dockerfile CHANGED
@@ -22,9 +22,12 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
22
  COPY sam2_server/ ./sam2_server/
23
 
24
  # 5) Build the release binary with caching
 
 
25
  RUN --mount=type=cache,target=/usr/local/cargo/registry \
26
  --mount=type=cache,target=/app/target \
27
- cargo build -p sam2_server --release --locked
 
28
 
29
  # ---------- Runtime stage ----------
30
  FROM debian:bookworm-slim AS runtime
@@ -36,7 +39,7 @@ RUN apt-get update \
36
  && rm -rf /var/lib/apt/lists/*
37
 
38
  # Copy binary and static assets
39
- COPY --from=builder /app/target/release/sam2_server /usr/local/bin/sam2_server
40
  COPY sam2_server/static ./sam2_server/static
41
 
42
  # Copy ONNX models to workdir root (the server expects them next to /app)
 
22
  COPY sam2_server/ ./sam2_server/
23
 
24
  # 5) Build the release binary with caching
25
+ # Note: artifacts in /app/target are on a cache mount and won't persist as image layers.
26
+ # We install the binary into /usr/local/bin to persist it for the next stage.
27
  RUN --mount=type=cache,target=/usr/local/cargo/registry \
28
  --mount=type=cache,target=/app/target \
29
+ cargo build -p sam2_server --release --locked && \
30
+ install -Dm755 target/release/sam2_server /usr/local/bin/sam2_server
31
 
32
  # ---------- Runtime stage ----------
33
  FROM debian:bookworm-slim AS runtime
 
39
  && rm -rf /var/lib/apt/lists/*
40
 
41
  # Copy binary and static assets
42
+ COPY --from=builder /usr/local/bin/sam2_server /usr/local/bin/sam2_server
43
  COPY sam2_server/static ./sam2_server/static
44
 
45
  # Copy ONNX models to workdir root (the server expects them next to /app)