-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
Copy pathDockerfile
74 lines (51 loc) · 2.14 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM python:3.10-slim AS base
# Install system dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y build-essential git libportaudio2 pandoc && \
rm -rf /var/lib/apt/lists/*
# Create app user with UID 1000
RUN useradd -m -u 1000 -s /bin/bash appuser
WORKDIR /app
# Create virtual environment
RUN python -m venv /venv
ENV PATH="/venv/bin:$PATH"
# Playwright browser settings
ENV PLAYWRIGHT_BROWSERS_PATH=/home/appuser/pw-browsers
ENV PLAYWRIGHT_SKIP_BROWSER_GC=1
# Create directories with proper permissions
RUN mkdir -p /home/appuser/.aider /home/appuser/.cache /home/appuser/pw-browsers && \
chown -R appuser:appuser /home/appuser /app /venv
# So git doesn't complain about unusual permissions
RUN git config --system --add safe.directory /app
#########################
FROM base AS aider-full
ENV AIDER_DOCKER_IMAGE=paulgauthier/aider-full
COPY . /tmp/aider
# Install dependencies as root
RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip && \
/venv/bin/python -m pip install --no-cache-dir /tmp/aider[help,browser,playwright] \
--extra-index-url https://download.pytorch.org/whl/cpu && \
rm -rf /tmp/aider
# Install playwright browsers
RUN /venv/bin/python -m playwright install --with-deps chromium
# Fix site-packages permissions
RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \)
# Switch to appuser
USER appuser
ENTRYPOINT ["/venv/bin/aider"]
#########################
FROM base AS aider
ENV AIDER_DOCKER_IMAGE=paulgauthier/aider
COPY . /tmp/aider
# Install dependencies as root
RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip && \
/venv/bin/python -m pip install --no-cache-dir /tmp/aider[playwright] \
--extra-index-url https://download.pytorch.org/whl/cpu && \
rm -rf /tmp/aider
# Install playwright browsers
RUN /venv/bin/python -m playwright install --with-deps chromium
# Fix site-packages permissions
RUN find /venv/lib/python3.10/site-packages \( -type d -exec chmod a+rwx {} + \) -o \( -type f -exec chmod a+rw {} + \)
# Switch to appuser
USER appuser
ENTRYPOINT ["/venv/bin/aider"]