AdarshJi commited on
Commit
562b2e9
·
verified ·
1 Parent(s): 3d3e1ee

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +38 -2
Dockerfile CHANGED
@@ -1,13 +1,49 @@
1
- FROM python:3.9
2
 
 
3
  RUN useradd -m -u 1000 user
4
 
5
  WORKDIR /app
6
 
7
- COPY --chown=user ./requirements.txt requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
 
 
9
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
10
 
11
  COPY --chown=user . /app
12
 
 
 
 
13
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.9-slim
2
 
3
+ # create non-root user (optional)
4
  RUN useradd -m -u 1000 user
5
 
6
  WORKDIR /app
7
 
8
+ # install system packages required by chrome + basic tools
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ ca-certificates \
11
+ wget \
12
+ gnupg \
13
+ unzip \
14
+ fonts-liberation \
15
+ libnss3 \
16
+ libxss1 \
17
+ libasound2 \
18
+ libatk1.0-0 \
19
+ libatk-bridge2.0-0 \
20
+ libcups2 \
21
+ libx11-xcb1 \
22
+ libxcomposite1 \
23
+ libxdamage1 \
24
+ libxrandr2 \
25
+ libgbm1 \
26
+ xdg-utils \
27
+ && rm -rf /var/lib/apt/lists/*
28
+
29
+ # install Google Chrome stable
30
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
31
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" \
32
+ > /etc/apt/sources.list.d/google-chrome.list \
33
+ && apt-get update \
34
+ && apt-get install -y --no-install-recommends google-chrome-stable \
35
+ && rm -rf /var/lib/apt/lists/*
36
+
37
+ # set environment variable so our code can pick up binary if needed
38
+ ENV CHROME_BIN=/usr/bin/google-chrome-stable
39
 
40
+ # install python dependencies
41
+ COPY --chown=user ./requirements.txt requirements.txt
42
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
43
 
44
  COPY --chown=user . /app
45
 
46
+ # optionally run as non-root user (uncomment if you want)
47
+ # USER user
48
+
49
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]