jhj0517 commited on
Commit
e4a303a
1 Parent(s): c595700

Add Dockerfile

Browse files
Files changed (3) hide show
  1. .dockerignore +13 -0
  2. Dockerfile +32 -0
  3. docker-compose.yaml +18 -0
.dockerignore ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ venv/
2
+ outputs/
3
+ modules/__pycache__/
4
+ models/
5
+ temp/
6
+
7
+ *.mp4
8
+ *.jpg
9
+ *.png
10
+
11
+ .idea
12
+ .git
13
+ .github
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build Stage
2
+ FROM debian:bookworm-slim AS builder
3
+
4
+ RUN apt-get update && \
5
+ apt-get install -y curl git python3 python3-pip python3-venv && \
6
+ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* && \
7
+ mkdir -p /sam2-playground
8
+
9
+ WORKDIR /sam2-playground
10
+
11
+ COPY requirements.txt .
12
+
13
+ RUN python3 -m venv venv && \
14
+ . venv/bin/activate && \
15
+ pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Runtime Stage
18
+ FROM debian:bookworm-slim AS runtime
19
+
20
+ RUN apt-get update && \
21
+ apt-get install -y curl ffmpeg python3 && \
22
+ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
23
+
24
+ WORKDIR /sam2-playground
25
+
26
+ COPY . .
27
+ COPY --from=builder /sam2-playground/venv /sam2-playground/venv
28
+
29
+ ENV PATH="/sam2-playground/venv/bin:$PATH"
30
+ ENV LD_LIBRARY_PATH="/sam2-playground/venv/lib64/python3.11/site-packages/nvidia/cublas/lib:/sam2-playground/venv/lib64/python3.11/site-packages/nvidia/cudnn/lib"
31
+
32
+ ENTRYPOINT ["python", "app.py"]
docker-compose.yaml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+
3
+ services:
4
+ app:
5
+ build: .
6
+ image: jhj0517/sam2-playground:latest
7
+
8
+ volumes:
9
+ # Mount models and output paths to your custom paths like this, e.g:
10
+ # - C:/sam2-models/custom/path:/sam2-playground/models
11
+ # - C:/sam2-playground-outputs/custom/path:/sam2-playground/outputs
12
+ - /sam2-playground/models
13
+ - /sam2-playground/outputs
14
+
15
+ ports:
16
+ - "8080:8080"
17
+
18
+ entrypoint: ["python", "app.py", "--server_port", "8080", "--server_name", "0.0.0.0",]