# Use an official Selenium Firefox standalone as a base image
FROM selenium/standalone-firefox:latest

USER root
# Set the working directory in the container
WORKDIR /app

# Install Python dependencies
COPY requirements.txt /app/
RUN pip install --break-system-packages --no-cache-dir -r requirements.txt && \
    playwright install

# Copy the current directory contents into the container at /app
COPY . /app
RUN mkdir -p /app/articles && \
    chown seluser:seluser /app/articles && \
    chmod 755 /app/articles

USER seluser                            
# Run the Flask app
CMD ["python3", "scraper.py"]

