File size: 1,009 Bytes
851f2ed
 
 
 
 
 
 
 
 
 
 
 
8ad62dc
851f2ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bcd1b4c
851f2ed
bcd1b4c
851f2ed
8ad62dc
851f2ed
 
bcd1b4c
851f2ed
bcd1b4c
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
# Use Python 3.11 slim base image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Set environment variables
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV LIGHTRAG_HOST=127.0.0.1
ENV LIGHTRAG_PORT=9621
ENV API_PORT=8000

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY . .

# Create non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app

RUN chmod +x /app/startup.sh && chown appuser:appuser /app/startup.sh

USER appuser

EXPOSE 8000

HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
  CMD sh -c 'curl -f http://localhost:${PORT:-8000}/health || exit 1'

CMD ["/app/startup.sh"]