AdarshJi commited on
Commit
57f70ae
·
verified ·
1 Parent(s): 77a846b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -16
Dockerfile CHANGED
@@ -1,12 +1,13 @@
 
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 \
@@ -24,26 +25,26 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
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"]
 
1
+ # Use a small Debian-based Python image
2
  FROM python:3.9-slim
3
 
4
  # create non-root user (optional)
5
  RUN useradd -m -u 1000 user
 
6
  WORKDIR /app
7
 
8
+ # Install system packages required by Chrome + basic tools
9
+ # Install gnupg so we can add the Google signing key via gpg --dearmor
10
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
11
  ca-certificates \
12
  wget \
13
  gnupg \
 
25
  libxrandr2 \
26
  libgbm1 \
27
  xdg-utils \
28
+ wget \
29
  && rm -rf /var/lib/apt/lists/*
30
 
31
+ # Add Google Chrome stable repository (secure method using signed-by keyring)
32
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor \
33
+ > /usr/share/keyrings/google-linux-signing-key.gpg \
34
+ && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-linux-signing-key.gpg] http://dl.google.com/linux/chrome/deb/ stable main" \
35
  > /etc/apt/sources.list.d/google-chrome.list \
36
+ && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends google-chrome-stable \
37
+ && rm -rf /var/lib/apt/lists/*
 
38
 
39
+ # Expose CHROME_BIN to the app (used by app.py)
40
  ENV CHROME_BIN=/usr/bin/google-chrome-stable
41
 
42
+ # Copy and install Python dependencies
43
+ COPY requirements.txt ./requirements.txt
44
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
45
 
46
+ # Copy app
47
+ COPY . /app
 
 
48
 
49
+ # Ensure the entrypoint runs uvicorn; run as root (if you want non-root, adjust flags)
50
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]