Files
browser-use/Dockerfile
2025-05-13 18:31:54 -04:00

39 lines
919 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 1. Base image
FROM python:3.11-slim
# 2. Create a non-root user (dont switch yet)
RUN groupadd appgroup \
&& useradd -m -g appgroup appuser
# 3. Install base APT packages
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends -qq \
unzip libnss3 libxss1 libasound2 libx11-xcb1 \
curl git \
&& rm -rf /var/lib/apt/lists/*
# 4. Set working directory
WORKDIR /app
# 5. Copy only dependency manifest
COPY pyproject.toml /app/
# 6. Install patchright (version from pyproject.toml)
RUN python3 -m pip install --upgrade pip --quiet \
&& python3 -m pip install patchright --quiet
# 7. Install Chromium via patchright
RUN playwright install --with-deps --no-shell chromium
# 8. Copy the rest of the codebase
COPY . /app
# 9. Install the application package
RUN python3 -m pip install . --quiet
# 10. Switch to non-root user
USER appuser
# 11. Entrypoint
ENTRYPOINT ["browser-use"]