MUSSIE1212 commited on
Commit
5162a29
·
1 Parent(s): 1af34cc

fix issues

Browse files
Files changed (3) hide show
  1. .dockerignore +4 -0
  2. Dockerfile +19 -11
  3. requirements.txt +3 -2
.dockerignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __pycache__/
2
+ *.log
3
+ *.pyc
4
+ .git/
Dockerfile CHANGED
@@ -1,22 +1,30 @@
1
-
2
- FROM python:3.9-slim-bullseye
3
 
4
  WORKDIR /app
5
 
6
- RUN apt-get update && \
7
- apt-get install -y --no-install-recommends \
8
- libgl1 \
9
- libglib2.0-0 \
10
- libsm6 \
11
- libxrender1 \
12
- libxext6 \
13
- && rm -rf /var/lib/apt/lists/*
14
 
 
 
15
  COPY requirements.txt .
16
 
 
17
  RUN pip install --upgrade pip && \
18
- pip install --no-cache-dir --timeout=1000 -r requirements.txt
 
 
 
 
 
 
 
 
19
 
 
 
20
  COPY . .
21
 
22
  EXPOSE 8000
 
1
+ # Build stage
2
+ FROM python:3.9-slim AS builder
3
 
4
  WORKDIR /app
5
 
6
+ RUN apt-get update && apt-get install -y --no-install-recommends
7
+
8
+
 
 
 
 
 
9
 
10
+
11
+ # Copy requirements and install other Python dependencies
12
  COPY requirements.txt .
13
 
14
+ # Install pre-installed torch first
15
  RUN pip install --upgrade pip && \
16
+ pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Final stage
19
+ FROM python:3.9-slim
20
+
21
+ WORKDIR /app
22
+
23
+ RUN apt-get update && apt-get install -y --no-install-recommends
24
+
25
 
26
+ # Copy files from the builder stage
27
+ COPY --from=builder /app /app
28
  COPY . .
29
 
30
  EXPOSE 8000
requirements.txt CHANGED
@@ -1,6 +1,7 @@
1
  fastapi
2
  uvicorn[standard]
3
- torchvision==0.17.2
4
  ultralytics
5
- pillow==10.3.0
6
  python-multipart
 
 
1
  fastapi
2
  uvicorn[standard]
3
+ torchvision
4
  ultralytics
5
+ pillow
6
  python-multipart
7
+ numpy