# gcontext CLOUD api (cloud_api.py) + the built React dashboard (web/). The connector
# (server.py) is NOT deployed — it runs on each user's machine. Build context is
# apps/mcp-minimal (Coolify base_directory).

# --- stage 1: build the React dashboard ---
FROM node:22-slim AS web
WORKDIR /web
COPY web/package.json web/package-lock.json* ./
RUN npm install
COPY web/ ./
RUN npm run build

# --- stage 2: python runtime ---
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir "psycopg[binary]>=3" "psycopg-pool>=3" "pyjwt[crypto]>=2"
COPY cloud_api.py .
COPY migrations ./migrations
COPY --from=web /web/dist ./web/dist
ENV HOST=0.0.0.0 PORT=8770
EXPOSE 8770
CMD ["python", "cloud_api.py"]
