-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
55 lines (40 loc) · 1.28 KB
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
47
48
49
50
51
52
53
54
55
# Multi-stage build for AI Explorer Backend
# Stage 1: Build dependencies
FROM python:3.13-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Set environment variables
ENV UV_CACHE_DIR=/tmp/uv-cache
# Set work directory
WORKDIR /app
# Copy dependency files
COPY pyproject.toml ./
# Install dependencies (generate lock file if needed)
RUN uv sync --no-dev
# Stage 2: Production image
FROM python:3.13-slim AS runtime
# Install uv and curl for runtime and health check
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Set work directory
WORKDIR /app
# Copy virtual environment from builder stage
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY app/ ./app/
COPY pyproject.toml ./
COPY alembic.ini ./
COPY alembic/ ./alembic/
# Setup for MCP servers
COPY mcp_servers/ ./mcp_servers/
COPY sdk/ ./sdk/
# Running script
COPY scripts/start.sh /app/scripts/start.sh
RUN chmod +x /app/scripts/start.sh
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Run the application
CMD ["/app/scripts/start.sh"]