# Simple Dockerfile for SEC Investment API with SQLite
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install git for yfinance-plus installation
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

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

# Install updated yfinance_plus from Gitea repository (base version)
RUN pip install git+https://gitea.yirugi.synology.me/yirugi/yfinance_plus.git@9fae52e

# Copy application code
COPY . .

# Override installed yfinance_plus with local version (adds .info property support)
RUN cp /app/yfinance_plus/yfinance_plus.py /usr/local/lib/python3.11/site-packages/yfinance_plus.py

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

# Expose port
EXPOSE 18000

# Run the application
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "18000", "--workers", "4"]