yurista commited on
Commit
a4c42ae
·
verified ·
1 Parent(s): d473bd6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -28
Dockerfile CHANGED
@@ -1,43 +1,36 @@
1
  # Dockerfile
2
- FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
3
 
4
- # Jika Anda tidak menggunakan GPU, ganti base image menjadi python:3.10-slim
5
- # FROM python:3.10-slim
6
-
7
- ENV DEBIAN_FRONTEND=noninteractive
8
  WORKDIR /app
9
 
10
- # system deps
11
- RUN apt-get update && apt-get install -y --no-install-recommends \
12
- build-essential \
 
13
  git \
14
  wget \
15
- curl \
16
- ca-certificates \
17
- libglib2.0-0 \
18
- libsm6 \
19
- libxext6 \
20
- libxrender-dev \
21
- ffmpeg \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
- # copy requirements
25
- COPY requirements.txt /app/
26
 
27
- # install python deps
28
- RUN python -m pip install --upgrade pip setuptools wheel
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
- # copy app
32
- COPY . /app
33
 
34
- # make dirs
35
- RUN mkdir -p uploads results models && chmod -R 777 uploads results models
36
-
37
- # copy SAM checkpoint if you have local copy (optional)
38
- # If you have local model file at build time, uncomment:
39
- # COPY models/sam_vit_b_01ec64.pth /app/models/sam_vit_b_01ec64.pth
40
 
 
41
  EXPOSE 7860
42
 
43
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
 
 
 
 
 
1
  # Dockerfile
2
+ FROM python:3.10-slim
3
 
4
+ # Set working directory
 
 
 
5
  WORKDIR /app
6
 
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ libgl1 \
10
+ libglib2.0-0 \
11
  git \
12
  wget \
 
 
 
 
 
 
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Copy requirements first for better caching
16
+ COPY requirements.txt .
17
 
18
+ # Install Python dependencies
 
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy application files
22
+ COPY app.py .
23
 
24
+ # Create necessary directories with permissions
25
+ RUN mkdir -p uploads processed models && \
26
+ chmod -R 777 uploads processed models
 
 
 
27
 
28
+ # Expose port
29
  EXPOSE 7860
30
 
31
+ # Health check
32
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
33
+ CMD python -c "import requests; requests.get('http://localhost:7860/')"
34
+
35
+ # Run the application
36
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]