Backend fix: - Add python3-dev to build dependencies for psutil compilation - psutil requires Python development headers to build C extensions Frontend fix: - Explicitly copy package-lock.json to ensure it's available for npm ci - Add verification step to confirm package-lock.json exists before npm ci - Prevents "npm ci" usage errors due to missing lock file
47 lines
1.1 KiB
Docker
47 lines
1.1 KiB
Docker
# Multi-stage build for Python backend
|
|
FROM python:3.11-slim as builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies for building Python packages
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
python3-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy requirements and install dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir --user -r requirements.txt
|
|
|
|
# Production stage
|
|
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy installed packages from builder
|
|
COPY --from=builder /root/.local /root/.local
|
|
|
|
# Make sure scripts in .local are usable
|
|
ENV PATH=/root/.local/bin:$PATH
|
|
|
|
# Copy application code
|
|
COPY ./app ./app
|
|
|
|
# Create directories
|
|
RUN mkdir -p /app/data /app/bots/logs /app/bots/configs /app/bots/examples
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Run the application
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|