FROM python:3.12

# Install system dependencies
RUN apt-get update && apt-get install -y \
    curl \
    unzip \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy application files
COPY . .

# Create config directory and copy cookies
RUN mkdir -p /config
COPY youtube.txt /config/youtube.txt

# Download and install Deno v2.7.13
RUN curl -fsSL https://github.com/denoland/deno/releases/download/v2.7.13/deno-x86_64-unknown-linux-gnu.zip -o deno.zip \
    && unzip deno.zip -d /config \
    && rm deno.zip \
    && chmod +x /config/deno

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Expose the application port
EXPOSE 5000

# Set entrypoint to run the Flask application
ENTRYPOINT ["python", "app.py"]
