aider/docker/Dockerfile
Paul Gauthier (aider) 67c4df09fd feat: create virtual environment for aider installation
The changes in this commit create a virtual environment for the aider application in the Docker image. The key changes are:

1. Removes the permission-related commands that were modifying system directories.
2. Creates a virtual environment at `/venv` and adds it to the PATH.
3. Installs aider and its dependencies into the virtual environment.
4. Updates the ENTRYPOINT to use the aider executable from the virtual environment.
5. Copies the aider source to a temporary directory (`/tmp/aider`) for installation, then removes it after installation.

These changes should address the concerns about modifying system permissions while still allowing the container to function properly for different users.
2024-07-31 10:14:29 -03:00

37 lines
948 B
Docker

FROM python:3.10-slim AS base
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential git libportaudio2 && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
RUN python -m venv /venv
ENV PATH="/venv/bin:$PATH"
# So git doesn't complain about unusual permissions
RUN git config --system --add safe.directory /app
#########################
FROM base AS aider-full
COPY . /tmp/aider
RUN pip install --upgrade pip \
&& pip install --no-cache-dir /tmp/aider[help,browser,playwright] \
--extra-index-url https://download.pytorch.org/whl/cpu \
&& rm -rf /tmp/aider
RUN playwright install --with-deps chromium
ENTRYPOINT ["/venv/bin/aider"]
#########################
FROM base AS aider
COPY . /tmp/aider
RUN pip install --upgrade pip \
&& pip install --no-cache-dir /tmp/aider \
--extra-index-url https://download.pytorch.org/whl/cpu \
&& rm -rf /tmp/aider
ENTRYPOINT ["/venv/bin/aider"]