forked from gptme/gptme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.github-bot
More file actions
63 lines (53 loc) · 2 KB
/
Dockerfile.github-bot
File metadata and controls
63 lines (53 loc) · 2 KB
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
# Dockerfile for gptme GitHub Bot
# Provides a standalone container for running the GitHub bot locally or in CI
#
# Build:
# docker build -t gptme-github-bot -f scripts/Dockerfile.github-bot .
#
# Run locally:
# docker run --rm \
# -e GITHUB_TOKEN="$GITHUB_TOKEN" \
# -e GITHUB_REPOSITORY="owner/repo" \
# -e OPENAI_API_KEY="$OPENAI_API_KEY" \
# -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
# -v $(pwd):/workspace \
# gptme-github-bot \
# --issue 123 --comment-body "@gptme What is this project about?"
#
# Test with dry run:
# docker run --rm \
# -e GITHUB_TOKEN="$GITHUB_TOKEN" \
# -e GITHUB_REPOSITORY="owner/repo" \
# -e DRY_RUN=1 \
# gptme-github-bot \
# --issue 123 --comment-body "@gptme Explain the README"
FROM python:3.12-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends gh \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -s /bin/bash botuser
USER botuser
WORKDIR /home/botuser
# Install gptme
RUN pip install --no-cache-dir --user gptme
# Add user bin to PATH
ENV PATH="/home/botuser/.local/bin:${PATH}"
# Copy the bot script
COPY --chown=botuser:botuser scripts/github_bot.py /home/botuser/github_bot.py
RUN chmod +x /home/botuser/github_bot.py
# Set working directory for workspace mount
WORKDIR /workspace
# Default entrypoint
ENTRYPOINT ["python3", "/home/botuser/github_bot.py"]
# Default to help
CMD ["--help"]