Spaces:
Sleeping
Sleeping
| FROM ubuntu:20.04 | |
| # Set non-interactive mode for APT | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Install necessary dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| gnupg \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| software-properties-common \ | |
| --no-install-recommends && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Add deadsnakes PPA for Python 3.10 | |
| RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update && apt-get install -y \ | |
| python3.10 \ | |
| python3.10-venv \ | |
| python3.10-dev \ | |
| curl \ | |
| --no-install-recommends && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Remove existing pip and install the latest version | |
| RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 | |
| # Install Chromium | |
| RUN apt-get update && apt-get install -y \ | |
| chromium-browser \ | |
| --no-install-recommends && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create a working directory | |
| WORKDIR /code | |
| # Copy requirements file | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install Python dependencies | |
| RUN python3.10 -m pip install --no-cache-dir --upgrade -r /code/requirements.txt && \ | |
| python3.10 -m pip install -U g4f[all] && \ | |
| python3.10 -m pip install -U g4f[webdriver] | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Set the command to run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |