shubham5524 commited on
Commit
3fc0271
·
verified ·
1 Parent(s): c6d5a36

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -23
Dockerfile CHANGED
@@ -1,31 +1,26 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
-
8
- # Install system dependencies for OpenCV
9
- RUN apt-get update && apt-get install -y \
10
- libgl1-mesa-glx \
11
- libglib2.0-0 \
12
- && rm -rf /var/lib/apt/lists/*
13
-
14
- # Set the working directory in the container
15
  WORKDIR /app
16
 
17
- # Copy requirements
18
- COPY requirements.txt .
 
 
 
19
 
20
- # Install Python dependencies
21
- RUN pip install --upgrade pip
22
- RUN pip install -r requirements.txt
 
23
 
24
- # Copy the app code
25
- COPY . .
 
26
 
27
- # Expose the port (change if your app uses a different port)
28
- EXPOSE 8000
29
 
30
- # Run the app using Uvicorn
31
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Use a Python base image
2
  FROM python:3.10-slim
3
 
4
+ # Set working directory
 
 
 
 
 
 
 
 
 
 
5
  WORKDIR /app
6
 
7
+ # Copy files
8
+ COPY . /app
9
+
10
+ # Install dependencies
11
+ RUN pip install --upgrade pip && pip install -r requirements.txt
12
 
13
+ # Create writable cache/config directories
14
+ RUN mkdir -p /app/cache/matplotlib && \
15
+ mkdir -p /app/cache/torchxrayvision && \
16
+ chmod -R 777 /app/cache
17
 
18
+ # Set environment variables for cache directories
19
+ ENV MPLCONFIGDIR=/app/cache/matplotlib
20
+ ENV TORCHXRAYVISION_CACHE=/app/cache/torchxrayvision
21
 
22
+ # Expose the port the app runs on
23
+ EXPOSE 7860
24
 
25
+ # Run the app
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]