Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (43 loc) · 1.84 KB
/
Copy pathDockerfile
File metadata and controls
58 lines (43 loc) · 1.84 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
# syntax=docker/dockerfile:1
# -----------------------------------------------------------------------------
# Stage 1: Build React Dashboard
# -----------------------------------------------------------------------------
FROM node:20-slim AS frontend-builder
WORKDIR /build
# Copy dashboard package definitions
COPY apps/dashboard/package*.json ./
RUN npm ci
# Copy dashboard source and build
COPY apps/dashboard/ ./
RUN npm run build
# -----------------------------------------------------------------------------
# Stage 2: Python Application Runtime
# -----------------------------------------------------------------------------
FROM python:3.11-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/packages/core:/app/packages/providers:/app/packages/analyzers:/app/packages/scoring:/app/packages/reporting:/app/packages/ai:/app/apps/api:/app/apps/cli
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy pyproject and install dependencies
COPY pyproject.toml README.md ./
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
pip install --no-cache-dir .
# Copy project source packages and applications
COPY packages/ ./packages/
COPY apps/api/ ./apps/api/
COPY apps/cli/ ./apps/cli/
# Copy built frontend assets from builder stage
COPY --from=frontend-builder /build/dist ./apps/dashboard/dist
# Install package in editable/local mode
RUN pip install --no-cache-dir -e . --no-deps
# Create runtime data directory
RUN mkdir -p /app/data && chmod 777 /app/data
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
CMD ["uvicorn", "libscope.api.main:app", "--host", "0.0.0.0", "--port", "8000"]