LogicGoInfotechSpaces commited on
Commit
fab68f1
·
verified ·
1 Parent(s): 1707de4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
  # Use official PyTorch image with CUDA support (T4 compatible)
2
  FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
3
 
 
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy application files
8
- COPY app.py .
9
  COPY requirements.txt .
10
 
11
- # Install Python dependencies
12
  RUN pip install --upgrade pip
13
- RUN pip install --no-cache-dir -r requirements.txt
14
 
15
- # Expose port for FastAPI
16
- EXPOSE 7860
17
 
18
- # Set environment variables for MongoDB credentials if needed
19
- # ENV MONGODB_URI="mongodb+srv://<user>:<password>@cluster.mongodb.net/?appName=API-LOGS"
20
 
21
- # Command to run FastAPI with Uvicorn
22
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
 
1
  # Use official PyTorch image with CUDA support (T4 compatible)
2
  FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
3
 
4
+ # Disable pip cache
5
+ ENV PIP_NO_CACHE_DIR=1
6
+
7
  # Set working directory
8
  WORKDIR /app
9
 
10
+ # Copy requirements first (cache-efficient)
 
11
  COPY requirements.txt .
12
 
13
+ # Install dependencies
14
  RUN pip install --upgrade pip
15
+ RUN pip install -r requirements.txt
16
 
17
+ # Now copy the actual application code
18
+ COPY . .
19
 
20
+ # Expose FastAPI port
21
+ EXPOSE 7860
22
 
23
+ # Run FastAPI (NO reload in production)
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]