# 1. Build stage: install dependencies
FROM python:3.11-slim AS builder
# Install Poetry (you can pin a version)
RUN pip install poetry
WORKDIR /app
# Copy only the lock & manifest first so we can cache this layer
COPY pyproject.toml poetry.lock /app/
# Tell Poetry not to create a virtualenv inside Docker
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev --no-root
# 2. Copy source code
COPY src/ /app/src/
COPY api/ /app/api/
# 3. Final image (optionally slim down further)
FROM python:3.11-slim
WORKDIR /app
# Copy the installed packages and your app code from the builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /app/src /app/src
COPY --from=builder /app/api /app/api
# Expose the port your app listens on
EXPOSE 8000
# Launch Uvicorn with your FastAPI app
CMD ["uvicorn", "walkxr_ai.api.main:app", "--host", "0.0.0.0", "--port", "8000"]