mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 04:14:59 +00:00
feat(docker): add support for running as non-root user
The changes in this commit add support for running the Docker container as a non-root user. Specifically: - Set permissions on the /.aider and /app directories to allow read/write/execute access for all users. - Configure Git to consider the /app directory as a safe directory, which prevents Git from complaining about unusual permissions when running as a non-root user. - Ensure that the Python site-packages directory and other relevant directories have read/write/execute permissions for all users, so that pip installs work even when running as a non-root user. These changes will allow the Docker container to be run with the `--user` flag, which is a common requirement for running containers in production environments.
This commit is contained in:
parent
1aaa8365d2
commit
745c0fcfef
1 changed files with 16 additions and 4 deletions
|
@ -5,23 +5,35 @@ RUN apt-get update && \
|
|||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN mkdir /.aider && chmod a+rwx /.aider
|
||||
|
||||
# So git doesn't complain about unusual permissions with `docker run --user xxx`
|
||||
RUN mkdir /app && chmod a+rwx /app && git config --system --add safe.directory /app
|
||||
|
||||
# So pip installs work even with `docker run --user xxx`
|
||||
RUN chmod a+rwx /usr/local/lib/python3.10/site-packages /usr/local/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
#########################
|
||||
FROM base AS aider-full
|
||||
|
||||
COPY . /aider
|
||||
RUN pip install --no-cache-dir /aider[help,browser,playwright] --extra-index-url https://download.pytorch.org/whl/cpu && \
|
||||
rm -rf /aider
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install --no-cache-dir /aider[help,browser,playwright] \
|
||||
--extra-index-url https://download.pytorch.org/whl/cpu \
|
||||
&& rm -rf /aider
|
||||
|
||||
RUN playwright install --with-deps chromium
|
||||
|
||||
ENTRYPOINT ["aider"]
|
||||
|
||||
#########################
|
||||
FROM base AS aider
|
||||
|
||||
COPY . /aider
|
||||
RUN pip install --no-cache-dir /aider --extra-index-url https://download.pytorch.org/whl/cpu && \
|
||||
rm -rf /aider
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install --no-cache-dir /aider \
|
||||
--extra-index-url https://download.pytorch.org/whl/cpu \
|
||||
&& rm -rf /aider
|
||||
|
||||
ENTRYPOINT ["aider"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue