Fix Docker and install files for current codebase

- Fix backend Dockerfile: install deps before copying source for
  proper layer caching (non-editable install)
- Add ai_insights, ai_score, ai_score_reason, ai_cost_usd columns
  to initial Alembic migration so fresh Docker deploys have full schema
- Add ANTHROPIC_API_KEY to docker-compose.yml, docker-compose.dev.yml,
  and .env.example
- Remove accidental backend/=0.40 pip artifact file

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
DJP 2026-02-23 21:54:41 -05:00
parent 2ef458ec72
commit 2425cd2677
6 changed files with 15 additions and 2 deletions

View file

@ -13,3 +13,6 @@ CORS_ORIGINS=http://localhost:1577
# Server
BACKEND_HOST=0.0.0.0
BACKEND_PORT=8000
# AI Design Analysis (optional — leave empty to disable)
ANTHROPIC_API_KEY=

View file

@ -1 +0,0 @@
(eval):1: command not found: pip

View file

@ -6,10 +6,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx libglib2.0-0 curl git && \
rm -rf /var/lib/apt/lists/*
# Copy dependency spec first for layer caching
COPY pyproject.toml .
RUN pip install --no-cache-dir -e . && \
# Install dependencies (non-editable, just deps)
RUN pip install --no-cache-dir . && \
pip install --no-cache-dir "deepgaze-pytorch @ git+https://github.com/matthias-k/DeepGaze.git"
# Copy application source
COPY . .
RUN mkdir -p data/uploads

View file

@ -45,6 +45,10 @@ def upgrade() -> None:
sa.Column('gaze_sequence', sa.JSON(), nullable=True),
sa.Column('hotspots', sa.JSON(), nullable=True),
sa.Column('overall_score', sa.Float(), nullable=True),
sa.Column('ai_insights', sa.JSON(), nullable=True),
sa.Column('ai_score', sa.Integer(), nullable=True),
sa.Column('ai_score_reason', sa.String(length=500), nullable=True),
sa.Column('ai_cost_usd', sa.Float(), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
sa.PrimaryKeyConstraint('id')

View file

@ -3,6 +3,8 @@ services:
build:
context: ./backend
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
environment:
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
volumes:
- ./backend:/app
- uploads:/app/data/uploads

View file

@ -24,6 +24,7 @@ services:
UPLOAD_DIR: /app/data/uploads
DEVICE: auto
CORS_ORIGINS: http://localhost:1577
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
volumes:
- uploads:/app/data/uploads
depends_on: