# Test Dockerfile to reproduce Railway environment locally
# Goal: Make local Linux environment match Railway until bot fails the same way

FROM ubuntu:24.04

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

# Install Python 3.13 using deadsnakes PPA
RUN apt-get update && apt-get install -y \
    software-properties-common \
    && add-apt-repository ppa:deadsnakes/ppa \
    && apt-get update \
    && apt-get install -y \
    python3.13 \
    python3.13-venv \
    python3.13-dev \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# Install uv for package management (like Railway uses)
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"

# Set working directory
WORKDIR /app/bots/screenshare-bot

# Copy bot files
COPY . .

# Create venv and install dependencies using uv
RUN uv venv .venv --python python3.13 && \
    UV_PROJECT_ENVIRONMENT=.venv uv sync

# Install Playwright chromium
RUN .venv/bin/playwright install chromium --with-deps

# Test: Run bot.py and capture output
# This should hang at asyncio import if we've matched Railway's environment
CMD [".venv/bin/python", "bot.py", "wss://test.example.com/test", "https://example.com/deck", "test-session", "test-bot", "fake-token"]
