Soham0708 commited on
Commit
2cd01c8
·
verified ·
1 Parent(s): bad4a76

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +48 -0
Dockerfile CHANGED
@@ -1,13 +1,61 @@
1
  FROM python:3.9
2
 
 
3
  RUN useradd -m -u 1000 user
4
  USER user
5
  ENV PATH="/home/user/.local/bin:$PATH"
6
 
 
7
  WORKDIR /app
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  COPY --chown=user ./requirements.txt requirements.txt
10
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
 
12
  COPY --chown=user . /app
 
 
13
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9
2
 
3
+ # Create a non-root user
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
7
 
8
+ # Set the working directory
9
  WORKDIR /app
10
 
11
+ # Install dependencies required for Chromium
12
+ USER root
13
+ RUN apt-get update && apt-get install -y \
14
+ wget \
15
+ unzip \
16
+ libnss3 \
17
+ libatk1.0-0 \
18
+ libatk-bridge2.0-0 \
19
+ libcups2 \
20
+ libgbm1 \
21
+ libxkbcommon0 \
22
+ libpango-1.0-0 \
23
+ libxcomposite1 \
24
+ libxrandr2 \
25
+ libasound2 \
26
+ libpangocairo-1.0-0 \
27
+ libxdamage1 \
28
+ libgtk-3-0 \
29
+ libxshmfence1 \
30
+ libxcb1 \
31
+ libx11-xcb1 \
32
+ libxrender1 \
33
+ libxfixes3 \
34
+ libxcursor1 \
35
+ libxinerama1 \
36
+ libgl1 \
37
+ libgl1-mesa-glx \
38
+ fonts-liberation \
39
+ libappindicator3-1 \
40
+ xdg-utils \
41
+ lsb-release \
42
+ && rm -rf /var/lib/apt/lists/*
43
+
44
+ # Install Chromium
45
+ RUN apt-get update && apt-get install -y chromium
46
+
47
+ # Set Chromium as the default browser
48
+ ENV CHROME_BIN=/usr/bin/chromium
49
+
50
+ # Switch back to the user context
51
+ USER user
52
+
53
+ # Install Python dependencies
54
  COPY --chown=user ./requirements.txt requirements.txt
55
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
56
 
57
+ # Copy the application code
58
  COPY --chown=user . /app
59
+
60
+ # Define the command to run the application
61
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]