# Mission Control v2 - Python CLI tool as web service
FROM python:3.11-slim

WORKDIR /app

# Install shared packages
COPY --from=packages jvdp-pipedrive /tmp/jvdp-pipedrive
RUN pip install --no-cache-dir /tmp/jvdp-pipedrive && rm -rf /tmp/jvdp-pipedrive

# Install dependencies
COPY requirements.txt requirements.lock* pyproject.toml ./
RUN pip install --no-cache-dir -r requirements.txt 2>/dev/null || pip install --no-cache-dir piexif Pillow

# Copy source
COPY . .

# Create data directory
RUN mkdir -p /app/data

EXPOSE 4545

# Simple HTTP health endpoint using Python
CMD ["python", "-c", "from http.server import HTTPServer, SimpleHTTPRequestHandler; HTTPServer(('0.0.0.0', 4545), SimpleHTTPRequestHandler).serve_forever()"]
