Spaces:
Build error
Build error
| # Use an official Python base image | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| # Set work directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| wget \ | |
| unzip \ | |
| curl \ | |
| gnupg \ | |
| ca-certificates \ | |
| fonts-liberation \ | |
| libappindicator3-1 \ | |
| libasound2 \ | |
| libatk-bridge2.0-0 \ | |
| libatk1.0-0 \ | |
| libcups2 \ | |
| libdbus-1-3 \ | |
| libgdk-pixbuf2.0-0 \ | |
| libnspr4 \ | |
| libnss3 \ | |
| libx11-xcb1 \ | |
| libxcomposite1 \ | |
| libxdamage1 \ | |
| libxrandr2 \ | |
| xdg-utils \ | |
| --no-install-recommends | |
| # Install Google Chrome | |
| RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ | |
| && dpkg -i google-chrome-stable_current_amd64.deb || apt-get -fy install \ | |
| && rm google-chrome-stable_current_amd64.deb | |
| # Install ChromeDriver (matching the installed Chrome version) | |
| RUN CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+') && \ | |
| wget -q -O /tmp/chromedriver.zip https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip && \ | |
| unzip /tmp/chromedriver.zip -d /tmp/ && \ | |
| mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/chromedriver && \ | |
| chmod +x /usr/local/bin/chromedriver && \ | |
| rm -rf /tmp/chromedriver* | |
| # Copy project files | |
| COPY . /app | |
| # Install Python dependencies | |
| RUN pip install --upgrade pip | |
| RUN pip install -r requirements.txt | |
| # Expose FastAPI default port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |