hamza2923 commited on
Commit
2988d6e
·
verified ·
1 Parent(s): af17e45

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE 1
4
+ ENV PYTHONUNBUFFERED 1
5
+
6
+ WORKDIR /app
7
+
8
+ # Install dependencies
9
+ RUN apt-get update && apt-get install -y \
10
+ wget curl unzip gnupg ca-certificates fonts-liberation \
11
+ libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 \
12
+ libcups2 libdbus-1-3 libgdk-pixbuf2.0-0 libnspr4 libnss3 \
13
+ libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 xdg-utils \
14
+ --no-install-recommends && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Install Google Chrome stable
17
+ RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
18
+ dpkg -i google-chrome-stable_current_amd64.deb || apt-get -fy install && \
19
+ rm google-chrome-stable_current_amd64.deb
20
+
21
+ # Get Chrome major version
22
+ RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+' | head -1) && \
23
+ echo "Detected Chrome major version: $CHROME_VERSION" && \
24
+ CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION") && \
25
+ echo "Matching ChromeDriver version: $CHROMEDRIVER_VERSION" && \
26
+ wget -q -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" && \
27
+ unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \
28
+ chmod +x /usr/local/bin/chromedriver && \
29
+ rm /tmp/chromedriver.zip
30
+
31
+ # Install Python dependencies
32
+ COPY requirements.txt .
33
+ RUN pip install --no-cache-dir -r requirements.txt
34
+
35
+ # Copy app code
36
+ COPY . /app
37
+
38
+ EXPOSE 7860
39
+
40
+ ENV PATH="/usr/local/bin:$PATH"
41
+
42
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]