FROM python:3.12-slim
WORKDIR /app
# Install system dependencies for browser-use
RUN apt-get update && apt-get install -y \
wget \
gnupg \
ca-certificates \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libgdk-pixbuf2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
libu2f-udev \
libvulkan1 \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install poetry==1.7.1
# Copy poetry configuration files
COPY pyproject.toml poetry.lock* ./
# Configure poetry to not create a virtual environment
RUN poetry config virtualenvs.create false
# Install dependencies
RUN poetry install --no-interaction --no-ansi
# Set the path for Playwright browsers
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
RUN playwright install-deps chromium
RUN playwright install chromium
# Copy application code
COPY . .
# Use xvfb-run to provide a virtual display for headed browser mode
CMD ["python", "main.py"]