File size: 1,240 Bytes
342fbcd
 
a78863a
f164442
f75b0eb
 
fe9dddd
 
 
80c0e31
45b97a4
0d8a725
e059113
 
 
182a8fe
0d8a725
 
 
 
 
 
 
 
 
 
447ee36
 
f164442
98334be
 
0d8a725
 
1c3dc0f
0d8a725
f164442
 
a78863a
f164442
 
a78863a
0d8a725
 
 
f164442
c8bbf26
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
41
42
43
44
45
46
# 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"]