Update Dockerfile
Browse files- Dockerfile +32 -20
Dockerfile
CHANGED
|
@@ -9,44 +9,56 @@ ENV PYTHONDONTWRITEBYTECODE=1
|
|
| 9 |
ENV PYTHONUNBUFFERED=1
|
| 10 |
ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
COPY requirements.txt .
|
| 14 |
-
|
| 15 |
-
# Install Python dependencies
|
| 16 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
-
|
| 18 |
-
# Install additional system dependencies if needed
|
| 19 |
RUN apt-get update && apt-get install -y \
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
libatk1.0-0 \
|
| 23 |
-
|
| 24 |
libcups2 \
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
libpango-1.0-0 \
|
| 30 |
-
|
| 31 |
-
fonts-liberation \
|
| 32 |
-
libappindicator1 \
|
| 33 |
libnss3 \
|
| 34 |
-
|
| 35 |
-
xdg-utils \
|
| 36 |
&& apt-get clean \
|
| 37 |
&& rm -rf /var/lib/apt/lists/*
|
| 38 |
|
| 39 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
RUN playwright install --with-deps chromium
|
| 41 |
|
| 42 |
# Copy the current directory contents into the container
|
| 43 |
COPY . .
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
# Ensure the correct permissions for the application directory
|
| 46 |
RUN chmod -R 755 /app
|
| 47 |
|
| 48 |
# Expose the port the app runs on
|
| 49 |
EXPOSE 8000
|
| 50 |
|
|
|
|
|
|
|
|
|
|
| 51 |
# Command to run the FastAPI application
|
| 52 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 9 |
ENV PYTHONUNBUFFERED=1
|
| 10 |
ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
|
| 11 |
|
| 12 |
+
# Install system dependencies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y \
|
| 14 |
+
libnss3 \
|
| 15 |
+
libnspr4 \
|
| 16 |
+
libdbus-1-3 \
|
| 17 |
libatk1.0-0 \
|
| 18 |
+
libatk-bridge2.0-0 \
|
| 19 |
libcups2 \
|
| 20 |
+
libdrm2 \
|
| 21 |
+
libxkbcommon0 \
|
| 22 |
+
libatspi2.0-0 \
|
| 23 |
+
libxcomposite1 \
|
| 24 |
+
libxdamage1 \
|
| 25 |
+
libxfixes3 \
|
| 26 |
+
libxrandr2 \
|
| 27 |
+
libgbm1 \
|
| 28 |
+
libasound2 \
|
| 29 |
libpango-1.0-0 \
|
| 30 |
+
libcairo2 \
|
|
|
|
|
|
|
| 31 |
libnss3 \
|
| 32 |
+
libxss1 \
|
|
|
|
| 33 |
&& apt-get clean \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
+
# Copy the requirements file into the container
|
| 37 |
+
COPY requirements.txt .
|
| 38 |
+
|
| 39 |
+
# Install Python dependencies
|
| 40 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 41 |
+
|
| 42 |
+
# Install Playwright
|
| 43 |
+
RUN pip install playwright
|
| 44 |
+
|
| 45 |
+
# Install Playwright browsers and dependencies
|
| 46 |
RUN playwright install --with-deps chromium
|
| 47 |
|
| 48 |
# Copy the current directory contents into the container
|
| 49 |
COPY . .
|
| 50 |
|
| 51 |
+
# Create the .crawl4ai directory with correct permissions
|
| 52 |
+
RUN mkdir /.crawl4ai && chmod 777 /.crawl4ai
|
| 53 |
+
|
| 54 |
# Ensure the correct permissions for the application directory
|
| 55 |
RUN chmod -R 755 /app
|
| 56 |
|
| 57 |
# Expose the port the app runs on
|
| 58 |
EXPOSE 8000
|
| 59 |
|
| 60 |
+
# Set environment variable to use the created directory
|
| 61 |
+
ENV CRAWL4AI_DB_PATH=/.crawl4ai
|
| 62 |
+
|
| 63 |
# Command to run the FastAPI application
|
| 64 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|