62 lines
2.0 KiB
Docker
62 lines
2.0 KiB
Docker
FROM python:3.12-slim
|
|||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Install system dependencies
|
||
|
|
RUN apt-get update && apt-get install -y \
|
||
|
|
build-essential \
|
||
|
|
libpq-dev \
|
||
|
|
netcat-traditional \
|
||
|
|
curl \
|
||
|
|
&& rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Install Python dependencies. Bump pip's per-request timeout and retry count so
|
||
|
|
# the large opencv/onnxruntime wheel downloads survive slow links and the
|
||
|
|
# heavier amd64/x86_64 wheels don't abort with ReadTimeoutError.
|
||
|
|
ENV PIP_DEFAULT_TIMEOUT=120
|
||
|
|
COPY backend/requirements.txt .
|
||
|
|
RUN pip install --no-cache-dir --retries 10 -r requirements.txt
|
||
|
|
RUN crawl4ai-setup
|
||
|
|
|
||
|
|
# Node.js + npx and uv/uvx for STDIO MCP servers (npx @elastic/mcp-server-…,
|
||
|
|
# uvx mcp-server-…). Copied from the official images instead of apt, which
|
||
|
|
# only ships an EOL Node 18 on bookworm. Kept below the pip layer so an
|
||
|
|
# upstream node/uv tag bump can't invalidate the cached pip layer.
|
||
|
|
COPY --from=node:22-slim /usr/local/bin/node /usr/local/bin/node
|
||
|
|
COPY --from=node:22-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
|
||
|
|
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
|
||
|
|
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
|
||
|
|
COPY --from=ghcr.io/astral-sh/uv:0.12 /uv /uvx /usr/local/bin/
|
||
|
|
|
||
|
|
# Copy application code
|
||
|
|
COPY backend/app ./app
|
||
|
|
COPY backend/alembic.ini .
|
||
|
|
COPY backend/alembic ./alembic
|
||
|
|
COPY backend/scripts ./scripts
|
||
|
|
COPY backend/assets ./assets
|
||
|
|
|
||
|
|
# Create required directories including cache directories
|
||
|
|
RUN mkdir -p uploads/agents && \
|
||
|
|
mkdir -p temp && \
|
||
|
|
mkdir -p .cache/huggingface/hub && \
|
||
|
|
chmod -R 755 .cache && \
|
||
|
|
chmod -R 755 temp
|
||
|
|
|
||
|
|
# Make startup script executable
|
||
|
|
RUN chmod +x ./scripts/start.sh
|
||
|
|
|
||
|
|
# Set environment variables
|
||
|
|
ENV PYTHONPATH=/app
|
||
|
|
ENV PORT=8000
|
||
|
|
ENV ENVIRONMENT=production
|
||
|
|
|
||
|
|
# Set HuggingFace cache directories
|
||
|
|
ENV HF_HOME=/app/.cache/huggingface
|
||
|
|
ENV HF_HUB_CACHE=/app/.cache/huggingface/hub
|
||
|
|
ENV HF_HUB_DISABLE_TELEMETRY=1
|
||
|
|
|
||
|
|
# Expose the port
|
||
|
|
EXPOSE 8000
|
||
|
|
|
||
|
|
# Run the startup script
|
||
|
|
CMD ["./scripts/start.sh"]
|