Sanket17 commited on
Commit
d0e789c
·
verified ·
1 Parent(s): d5fe318

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -12
Dockerfile CHANGED
@@ -1,20 +1,30 @@
1
- FROM python:3.9-slim
 
2
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
 
 
 
 
 
5
  COPY . /app
6
 
7
- RUN apt-get update && apt-get install -y \
8
- libgl1-mesa-glx && \
9
- apt-get clean && \
10
- rm -rf /var/lib/apt/lists/*
11
 
12
- RUN pip install --no-cache-dir --upgrade pip
13
- RUN pip install -r requirements.txt
14
 
15
- # Set environment variable for cache
16
- ENV TRANSFORMERS_CACHE=/app/cache
17
- RUN mkdir -p /app/cache
18
 
19
- EXPOSE 7860
20
- CMD ["python", "app.py"]
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.8-slim
3
 
4
+ # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ libglib2.0-0 \
10
+ libsm6 \
11
+ libxrender1 \
12
+ libxext6
13
+
14
+ # Set environment variable for transformers cache
15
+ ENV TRANSFORMERS_CACHE=/app/cache
16
+
17
+ # Copy the current directory contents into the container at /app
18
  COPY . /app
19
 
20
+ # Install any needed packages specified in requirements.txt
21
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
22
 
23
+ # Expose port 8000 for the FastAPI app
24
+ EXPOSE 8000
25
 
26
+ # Create cache directory
27
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
 
28
 
29
+ # Run the FastAPI app with uvicorn
30
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]