FROM continuumio/miniconda3:latest

WORKDIR /app

# Install circuitforge-core from sibling directory
COPY circuitforge-core/ ./circuitforge-core/
RUN conda run -n base pip install --no-cache-dir -e ./circuitforge-core

# Create waxwing conda env (named cf for consistency with host convention)
COPY waxwing/environment.yml .
RUN conda env create -f environment.yml || conda run -n cf pip install --no-cache-dir \
    "fastapi>=0.110" "uvicorn[standard]>=0.27" "pydantic>=2.5" "httpx>=0.27" "pyyaml>=6.0"

COPY waxwing/ ./waxwing/

RUN rm -f /app/waxwing/.env /app/waxwing/CLAUDE.md

RUN conda run -n cf pip install --no-cache-dir -e /app/circuitforge-core
WORKDIR /app/waxwing
RUN conda run -n cf pip install --no-cache-dir -e .

EXPOSE 8522
CMD ["conda", "run", "--no-capture-output", "-n", "cf", \
     "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8522"]
