FROM python:3.12-slim

# Metadata
LABEL maintainer="CTW Team"
LABEL description="MCP Jira Server - Connects Claude Desktop to Jira"

# Environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

# Install system dependencies and Poetry
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/* \
    && pip install poetry

# Create working directory
WORKDIR /app

# Copy Poetry files first
COPY pyproject.toml ./

# Install dependencies using Poetry
RUN poetry config virtualenvs.create false \
    && poetry install --no-interaction --no-ansi --no-root

# Copy application code
COPY . .

# Default command (run the server)
CMD ["python", "main.py"]
