-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.minimal
More file actions
66 lines (50 loc) · 1.92 KB
/
Dockerfile.minimal
File metadata and controls
66 lines (50 loc) · 1.92 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
56
57
58
59
60
61
62
63
64
65
66
# syntax=docker/dockerfile:1.7
# Minimal Docker image - Code Graph only (No LLM required)
#
# IMPORTANT: Frontend MUST be pre-built before docker build:
# ./scripts/build-frontend.sh
#
# This Dockerfile expects frontend/dist/ to exist
# ============================================
# Builder stage - Only install dependencies
# ============================================
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS builder
WORKDIR /app
# Copy requirements.txt for optimal layer caching
COPY requirements.txt ./
# Install Python dependencies using uv with BuildKit cache
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system --no-cache -r requirements.txt
# ============================================
# Final stage
# ============================================
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEPLOYMENT_MODE=minimal \
PATH="/app:${PATH}"
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 appuser && \
mkdir -p /app /data /repos && \
chown -R appuser:appuser /app /data /repos
WORKDIR /app
# Copy Python packages from builder
COPY --from=builder /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=builder /usr/local/bin/uvicorn /usr/local/bin/
# Copy application code
COPY --chown=appuser:appuser src ./src
# Copy pre-built frontend (MUST exist - run ./scripts/build-frontend.sh first)
COPY --chown=appuser:appuser frontend/dist ./static
USER appuser
# Two-Port Architecture
EXPOSE 8000 8080
# Health check on Web UI port
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8080/api/v1/health || exit 1
# Start application (dual-port mode)
CMD ["python", "-m", "codebase_rag"]