prshntdxt commited on
Commit
f462fe5
·
verified ·
1 Parent(s): c97b972

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -10
Dockerfile CHANGED
@@ -1,8 +1,12 @@
 
1
  FROM python:3.11-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # System dependencies for TensorFlow / HDF5
 
 
6
  RUN apt-get update && apt-get install -y \
7
  libsm6 \
8
  libxext6 \
@@ -11,25 +15,41 @@ RUN apt-get update && apt-get install -y \
11
  pkg-config \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # Install Python dependencies
 
 
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
 
 
 
 
 
 
18
  # Copy application code
 
19
  COPY main.py .
20
  COPY schemas.py .
21
  COPY inference/ ./inference/
22
 
23
- # Copy model
24
- COPY models/Forest_Segmentation_Best.keras ./models/
 
 
25
 
26
- # Logs directory
27
- RUN mkdir -p logs
 
 
 
28
 
29
- # Hugging Face uses 7860
 
 
30
  EXPOSE 7860
31
 
32
- ENV PYTHONUNBUFFERED=1
33
-
34
- # Start FastAPI
35
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Base image
2
  FROM python:3.11-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # -------------------------------------------------
8
+ # System dependencies (TensorFlow / HDF5 support)
9
+ # -------------------------------------------------
10
  RUN apt-get update && apt-get install -y \
11
  libsm6 \
12
  libxext6 \
 
15
  pkg-config \
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # -------------------------------------------------
19
+ # Python dependencies
20
+ # -------------------------------------------------
21
  COPY requirements.txt .
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # -------------------------------------------------
25
+ # Create required directories FIRST
26
+ # -------------------------------------------------
27
+ RUN mkdir -p models logs
28
+
29
+ # -------------------------------------------------
30
  # Copy application code
31
+ # -------------------------------------------------
32
  COPY main.py .
33
  COPY schemas.py .
34
  COPY inference/ ./inference/
35
 
36
+ # -------------------------------------------------
37
+ # Copy trained model (FIXED)
38
+ # -------------------------------------------------
39
+ COPY models/Forest_Segmentation_Best.keras models/Forest_Segmentation_Best.keras
40
 
41
+ # -------------------------------------------------
42
+ # Environment variables
43
+ # -------------------------------------------------
44
+ ENV PYTHONUNBUFFERED=1
45
+ ENV PORT=7860
46
 
47
+ # -------------------------------------------------
48
+ # Hugging Face Spaces port
49
+ # -------------------------------------------------
50
  EXPOSE 7860
51
 
52
+ # -------------------------------------------------
53
+ # Run FastAPI server
54
+ # -------------------------------------------------
55
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]