michelerussoAA commited on
Commit
488fb08
·
verified ·
1 Parent(s): b5b43c5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -5
Dockerfile CHANGED
@@ -2,13 +2,12 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- # system deps + Firefox & geckodriver
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  unzip \
9
  xvfb \
10
  firefox-esr \
11
- geckodriver \
12
  libgtk-3-0 \
13
  libdbus-glib-1-2 \
14
  libx11-xcb1 \
@@ -17,13 +16,21 @@ RUN apt-get update && apt-get install -y \
17
  libasound2 \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # Python deps
 
 
 
 
 
 
 
 
21
  COPY requirements.txt .
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # copy code
25
  COPY . .
26
 
27
- # expose port and entrypoint as before
28
  EXPOSE 7860
29
  CMD ["uvicorn", "scraper:app", "--host", "0.0.0.0", "--port", "7860"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # 1) System deps + Firefox
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  unzip \
9
  xvfb \
10
  firefox-esr \
 
11
  libgtk-3-0 \
12
  libdbus-glib-1-2 \
13
  libx11-xcb1 \
 
16
  libasound2 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # 2) Download & install geckodriver v0.34.0
20
+ RUN GECKO_VERSION=v0.34.0 \
21
+ && wget -qO /tmp/geckodriver.tar.gz \
22
+ "https://github.com/mozilla/geckodriver/releases/download/${GECKO_VERSION}/geckodriver-${GECKO_VERSION}-linux64.tar.gz" \
23
+ && tar -xzf /tmp/geckodriver.tar.gz -C /usr/local/bin/ \
24
+ && chmod +x /usr/local/bin/geckodriver \
25
+ && rm /tmp/geckodriver.tar.gz
26
+
27
+ # 3) Python deps
28
  COPY requirements.txt .
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # 4) Your scraper code
32
  COPY . .
33
 
34
+ # 5) Expose & run
35
  EXPOSE 7860
36
  CMD ["uvicorn", "scraper:app", "--host", "0.0.0.0", "--port", "7860"]