scrollable-scrapper/Dockerfile

48 lines
1.2 KiB
Docker

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV DISPLAY=:99
# System deps
RUN apt-get update && apt-get install -y \
wget curl unzip xvfb \
libgtk-3-0 libnss3 libatk-bridge2.0-0 libcups2 \
libxcomposite1 libxrandr2 libgbm1 libasound2t64 \
libxdamage1 libxfixes3 libxkbcommon0 libpango-1.0-0 libcairo2 \
fonts-liberation fonts-noto-color-emoji \
&& rm -rf /var/lib/apt/lists/*
# Install Chrome
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get update \
&& apt-get install -y ./google-chrome-stable_current_amd64.deb \
&& rm google-chrome-stable_current_amd64.deb
# Install Python
RUN apt-get update && apt-get install -y python3 python3-venv python3-pip
# Create virtualenv
RUN python3 -m venv /venv
# Activate venv by default
ENV PATH="/venv/bin:$PATH"
# Upgrade pip inside venv
RUN pip install --upgrade pip
# Install Python deps
RUN pip install seleniumbase pika fastapi uvicorn bs4
# Install drivers
RUN seleniumbase get chromedriver
# App
WORKDIR /app
COPY scraper_api.py /app/scraper_api.py
# Entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["/entrypoint.sh"]