File size: 1,217 Bytes
cb92864 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | # Base image with Python 3.10
FROM python:3.10-slim
# Install system dependencies including Chrome (Chromium) and ChromeDriver for Selenium
RUN apt-get update && apt-get install -y \
wget \
gnupg \
unzip \
curl \
chromium \
chromium-driver \
&& rm -rf /var/lib/apt/lists/*
# Set working directory inside container
WORKDIR /app
# Create a non-root user (UID 1000) for Hugging Face Spaces compatibility
RUN useradd -m -u 1000 user
RUN chown user:user /app
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
CHROME_BIN=/usr/bin/chromium \
CHROMEDRIVER_PATH=/usr/bin/chromedriver \
PYTHONPATH=/app
# Copy requirements and install python dependencies
COPY --chown=user web_app/requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
# Copy all essential packages into container working directory
COPY --chown=user pipeline /app/pipeline
COPY --chown=user web_app /app/web_app
# Expose standard Hugging Face Space port
EXPOSE 7860
# Run Streamlit on port 7860 and address 0.0.0.0 (app.py is inside web_app/)
CMD ["streamlit", "run", "web_app/app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
|