web-crawling / Dockerfile
pvanand's picture
Update Dockerfile
e059113 verified
raw
history blame
1.24 kB
# Use the official Python 3.10.9 image as the base
FROM python:3.10.9
# Set the working directory in the container
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
# Install system dependencies
RUN apt-get update && apt-get install -y \
wkhtmltopdf \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Install Playwright
RUN pip install playwright
# Install Playwright browsers and dependencies
RUN playwright install --with-deps chromium
# Copy the current directory contents into the container
COPY . .
# Create the .crawl4ai directory with correct permissions
RUN mkdir /.crawl4ai && chmod 777 /.crawl4ai
RUN mkdir /.tempfiles && chmod 777 /.tempfiles
# Ensure the correct permissions for the application directory
RUN chmod -R 755 /app
# Expose the port the app runs on
EXPOSE 8000
# Set environment variable to use the created directory
ENV CRAWL4AI_DB_PATH=/.crawl4ai
# Command to run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]