fix playwright install in both docker images

This commit is contained in:
Paul Gauthier 2024-08-19 15:02:53 -07:00
parent 2dd7d2e0b6
commit 69b76c23e8

View file

@ -1,7 +1,7 @@
FROM python:3.10-slim AS base FROM python:3.10-slim AS base
RUN apt-get update && \ RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential git libportaudio2 && \ apt-get install --no-install-recommends -y build-essential git libportaudio2 pandoc && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
@ -9,11 +9,15 @@ WORKDIR /app
RUN python -m venv /venv RUN python -m venv /venv
ENV PATH="/venv/bin:$PATH" ENV PATH="/venv/bin:$PATH"
# https://playwright.dev/python/docs/browsers
ENV PLAYWRIGHT_BROWSERS_PATH=/pw-browsers
ENV PLAYWRIGHT_SKIP_BROWSER_GC=1
# Permission kludges to support `docker run --user xxx` # Permission kludges to support `docker run --user xxx`
RUN chmod a+rwx /venv /venv/bin /venv/include /venv/lib /venv/lib/python3.10/site-packages RUN chmod a+rwx /venv /venv/bin /venv/include /venv/lib /venv/lib/python3.10/site-packages
RUN mkdir /.aider /.cache RUN mkdir /.aider /.cache /pw-browsers
RUN chmod a+rwx /.aider /.cache RUN chmod a+rwx /.aider /.cache /pw-browsers
# So git doesn't complain about unusual permissions # So git doesn't complain about unusual permissions
RUN git config --system --add safe.directory /app RUN git config --system --add safe.directory /app
@ -29,8 +33,8 @@ RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \
--extra-index-url https://download.pytorch.org/whl/cpu \ --extra-index-url https://download.pytorch.org/whl/cpu \
&& rm -rf /tmp/aider && rm -rf /tmp/aider
RUN /venv/bin/python -m playwright install --with-deps chromium
RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \) RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \)
RUN playwright install --with-deps chromium
ENTRYPOINT ["/venv/bin/aider"] ENTRYPOINT ["/venv/bin/aider"]
@ -41,10 +45,11 @@ ENV AIDER_DOCKER_IMAGE=paulgauthier/aider
COPY . /tmp/aider COPY . /tmp/aider
RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \ RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \
&& /venv/bin/python -m pip install --no-cache-dir /tmp/aider \ && /venv/bin/python -m pip install --no-cache-dir /tmp/aider[playwright] \
--extra-index-url https://download.pytorch.org/whl/cpu \ --extra-index-url https://download.pytorch.org/whl/cpu \
&& rm -rf /tmp/aider && rm -rf /tmp/aider
RUN /venv/bin/python -m playwright install --with-deps chromium
RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \) RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \)
ENTRYPOINT ["/venv/bin/aider"] ENTRYPOINT ["/venv/bin/aider"]