Soham0708 commited on
Commit
68b0607
·
verified ·
1 Parent(s): 4591f60

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -3
Dockerfile CHANGED
@@ -1,4 +1,6 @@
1
- FROM python:3.9
 
 
2
 
3
  # Install necessary system dependencies for Pyppeteer/Chrome
4
  RUN apt-get update && apt-get install -y \
@@ -25,6 +27,27 @@ RUN apt-get update && apt-get install -y \
25
  libgtk-3-0 \
26
  --no-install-recommends
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  # Clean up APT when done
29
  RUN apt-get clean && rm -rf /var/lib/apt/lists/*
30
 
@@ -33,6 +56,7 @@ RUN useradd -m -u 1000 user
33
  USER user
34
  ENV PATH="/home/user/.local/bin:$PATH"
35
 
 
36
  WORKDIR /app
37
 
38
  # Install Python dependencies as non-root user
@@ -42,5 +66,8 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
42
  # Copy application code as non-root user
43
  COPY --chown=user . /app
44
 
45
- # Command to run the FastAPI application
46
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.11-slim
3
+
4
 
5
  # Install necessary system dependencies for Pyppeteer/Chrome
6
  RUN apt-get update && apt-get install -y \
 
27
  libgtk-3-0 \
28
  --no-install-recommends
29
 
30
+
31
+ # Install necessary packages
32
+ RUN apt-get update && \
33
+ apt-get install -y \
34
+ wget \
35
+ gnupg \
36
+ software-properties-common \
37
+ xvfb \
38
+ libxi6 \
39
+ libgconf-2-4 \
40
+ snapd \
41
+ && rm -rf /var/lib/apt/lists/*
42
+
43
+ # Install Google Chrome
44
+ RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
45
+ apt-get install -y ./google-chrome-stable_current_amd64.deb && \
46
+ rm google-chrome-stable_current_amd64.deb
47
+
48
+ # Install Chromium
49
+ RUN snap install chromium
50
+
51
  # Clean up APT when done
52
  RUN apt-get clean && rm -rf /var/lib/apt/lists/*
53
 
 
56
  USER user
57
  ENV PATH="/home/user/.local/bin:$PATH"
58
 
59
+ # Set the working directory
60
  WORKDIR /app
61
 
62
  # Install Python dependencies as non-root user
 
66
  # Copy application code as non-root user
67
  COPY --chown=user . /app
68
 
69
+ # Expose the port the application runs on
70
+ EXPOSE 7860
71
+
72
+ # Command to run the FastAPI application using xvfb-run
73
+ CMD ["xvfb-run", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]