rishab1090 commited on
Commit
7744f07
·
verified ·
1 Parent(s): a515dc8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -12
Dockerfile CHANGED
@@ -1,21 +1,33 @@
1
- # Use official Python image
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
- ENV PYTHONHASHSEED=0
8
-
9
- # Create working directory
10
- WORKDIR /app
11
 
12
  # Install dependencies
13
- COPY requirements.txt .
14
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
15
 
16
- # Copy app files
17
  COPY . .
18
 
19
- # Expose port and run
 
 
 
 
20
  EXPOSE 8000
 
 
21
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # Base image
2
  FROM python:3.10-slim
3
 
4
+ # Set env vars to reduce image size and fix random_device bug
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1 \
7
+ PYTHONHASHSEED=0
 
 
 
8
 
9
  # Install dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ build-essential \
12
+ libglib2.0-0 \
13
+ libsm6 \
14
+ libxrender1 \
15
+ libxext6 \
16
+ libgl1-mesa-glx \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Set workdir
20
+ WORKDIR /app
21
 
22
+ # Copy files
23
  COPY . .
24
 
25
+ # Install Python dependencies
26
+ RUN pip install --upgrade pip
27
+ RUN pip install --no-cache-dir -r requirements.txt
28
+
29
+ # Expose port
30
  EXPOSE 8000
31
+
32
+ # Start API
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]