FROM python:3.11-slim

WORKDIR /app

# Install system dependencies including network tools
RUN apt-get update && apt-get install -y \
    curl \
    net-tools \
    iproute2 \
    procps \
    lsof \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY homelab_requirements.txt .
RUN pip install --no-cache-dir -r homelab_requirements.txt

# Copy application code
COPY . .

# Create non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser

EXPOSE 8383

CMD ["python", "samcloud_app.py"]
