feliksius commited on
Commit
5e08720
·
verified ·
1 Parent(s): 526c532

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -11
Dockerfile CHANGED
@@ -1,26 +1,26 @@
1
- # Use a lightweight Python base image
2
  FROM python:3.10-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy requirements.txt
8
  COPY requirements.txt .
9
 
10
- # Install dependencies
11
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
12
 
13
  # Copy application code
14
- COPY . .
15
 
16
- # Set environment variables for Hugging Face cache
17
- ENV HF_HOME=/app/cache
18
- ENV TRANSFORMERS_CACHE=/app/cache
19
- # Set to 1 if using quantization and GPU is available
20
- ENV USE_QUANTIZATION=0
21
 
22
  # Expose port for FastAPI
23
  EXPOSE 8000
24
 
25
- # Run the FastAPI app with uvicorn (updated to use app.py)
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use official Python 3.10 slim image for a smaller footprint
2
  FROM python:3.10-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Copy requirements file
8
  COPY requirements.txt .
9
 
10
+ # Install system dependencies and Python packages
11
+ RUN apt-get update && apt-get install -y \
12
+ gcc \
13
+ && rm -rf /var/lib/apt/lists/* \
14
+ && pip install --no-cache-dir -r requirements.txt
15
 
16
  # Copy application code
17
+ COPY app.py .
18
 
19
+ # Create cache directory for Hugging Face models
20
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
 
 
 
21
 
22
  # Expose port for FastAPI
23
  EXPOSE 8000
24
 
25
+ # Run Uvicorn server
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]