Docker tested on Windows machine.
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -149,7 +149,15 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|||||||
python -c "import crawl4ai; print('✅ crawl4ai is ready to rock!')" && \
|
python -c "import crawl4ai; print('✅ crawl4ai is ready to rock!')" && \
|
||||||
python -c "from playwright.sync_api import sync_playwright; print('✅ Playwright is feeling dramatic!')"
|
python -c "from playwright.sync_api import sync_playwright; print('✅ Playwright is feeling dramatic!')"
|
||||||
|
|
||||||
RUN playwright install --with-deps chromium
|
RUN crawl4ai-setup
|
||||||
|
|
||||||
|
RUN playwright install --with-deps
|
||||||
|
|
||||||
|
RUN mkdir -p /home/appuser/.cache/ms-playwright \
|
||||||
|
&& cp -r /root/.cache/ms-playwright/chromium-* /home/appuser/.cache/ms-playwright/ \
|
||||||
|
&& chown -R appuser:appuser /home/appuser/.cache/ms-playwright
|
||||||
|
|
||||||
|
RUN crawl4ai-doctor
|
||||||
|
|
||||||
# Copy application code
|
# Copy application code
|
||||||
COPY deploy/docker/* ${APP_HOME}/
|
COPY deploy/docker/* ${APP_HOME}/
|
||||||
@@ -174,4 +182,8 @@ EXPOSE 6379
|
|||||||
# Switch to the non-root user before starting the application
|
# Switch to the non-root user before starting the application
|
||||||
USER appuser
|
USER appuser
|
||||||
|
|
||||||
|
# Set environment variables to ptoduction
|
||||||
|
ENV PYTHON_ENV=production
|
||||||
|
|
||||||
|
# Start the application using supervisord
|
||||||
CMD ["supervisord", "-c", "supervisord.conf"]
|
CMD ["supervisord", "-c", "supervisord.conf"]
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
# This file is in the root directory alongside Dockerfile
|
|
||||||
|
|
||||||
# Base configuration anchor for reusability
|
# Base configuration anchor for reusability
|
||||||
x-base-config: &base-config
|
x-base-config: &base-config
|
||||||
@@ -9,7 +8,7 @@ x-base-config: &base-config
|
|||||||
# - "8080:8080" # Uncomment if needed
|
# - "8080:8080" # Uncomment if needed
|
||||||
|
|
||||||
# Load API keys primarily from .llm.env file
|
# Load API keys primarily from .llm.env file
|
||||||
# Create .llm.env in the root directory from deploy/docker/.llm.env.example
|
# Create .llm.env in the root directory .llm.env.example
|
||||||
env_file:
|
env_file:
|
||||||
- .llm.env
|
- .llm.env
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import asyncio
|
|||||||
import os
|
import os
|
||||||
from typing import List, Dict, Any, AsyncGenerator
|
from typing import List, Dict, Any, AsyncGenerator
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
# Optional: Import crawl4ai classes directly for reference/easier payload creation aid
|
# Optional: Import crawl4ai classes directly for reference/easier payload creation aid
|
||||||
# You don't strictly NEED these imports for the tests to run against the server,
|
# You don't strictly NEED these imports for the tests to run against the server,
|
||||||
# but they help in understanding the structure you are mimicking in JSON.
|
# but they help in understanding the structure you are mimicking in JSON.
|
||||||
@@ -29,7 +33,8 @@ from crawl4ai import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# --- Test Configuration ---
|
# --- Test Configuration ---
|
||||||
BASE_URL = os.getenv("CRAWL4AI_TEST_URL", "http://localhost:8020") # Make base URL configurable
|
# BASE_URL = os.getenv("CRAWL4AI_TEST_URL", "http://localhost:8020") # Make base URL configurable
|
||||||
|
BASE_URL = os.getenv("CRAWL4AI_TEST_URL", "http://localhost:11235") # Make base URL configurable
|
||||||
# Use a known simple HTML page for basic tests
|
# Use a known simple HTML page for basic tests
|
||||||
SIMPLE_HTML_URL = "https://httpbin.org/html"
|
SIMPLE_HTML_URL = "https://httpbin.org/html"
|
||||||
# Use a site suitable for scraping tests
|
# Use a site suitable for scraping tests
|
||||||
|
|||||||
Reference in New Issue
Block a user