fix: make docker compose build and start the API

The image context was backend/, so COPY frontend/ failed. Build from the
repo root, place Python modules on the import path, and pin packages that
exist on PyPI. The web process no longer loads the LLM at startup.
This commit is contained in:
lgcosta committed 2026-11-01 12:00:08 -03:00
1 parent 67739dcf7e
commit 7af7ba530d
19 files changed
+342 -250

No files matched your search

+10 -15
View File
@@ -2,32 +2,27 @@ FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create directories
RUN mkdir -p /app/uploads /app/index /app/models
RUN mkdir -p /app/uploads /app/index /app/models /app/books
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variables
ENV GPT4ALL_MODEL=llama-3.2-3b-instruct-q4_0.gguf
ENV PYTHONPATH=/app
ENV GPT4ALL_MODEL=/app/models/llama-3.2-3b-instruct-q4_0.gguf
ENV UPLOAD_DIR=/app/uploads
ENV BOOKS_DIR=/app/books
ENV INDEX_DIR=/app/index
ENV SCHEDULES_PATH=/app/schedules.json
# Copy application
COPY app/ ./app/
COPY frontend/ ./frontend/
COPY backend/app ./app
COPY backend/templates ./templates
COPY backend/scripts ./scripts
COPY frontend ./frontend
# Expose ports
EXPOSE 8000
# Run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]