11# Use an official Rust image as a parent image
2- FROM rust:latest
2+ FROM rust:latest AS base
33
44# Install dependencies
55RUN apt-get update && apt-get install -y git fish
@@ -18,3 +18,37 @@ COPY ./scripts/integration-tests scripts/integration-tests
1818
1919# Run the script
2020CMD ["fish" , "./scripts/integration-tests" ]
21+
22+ # Target for testing PRs with GH CLI
23+ FROM rust:latest AS pr-tester
24+
25+ # Install wget and GH CLI
26+ RUN apt-get update && apt-get install -y git fish wget \
27+ && mkdir -p -m 755 /etc/apt/keyrings \
28+ && wget -nv -O /tmp/githubcli-archive-keyring.gpg https://cli.github.com/packages/githubcli-archive-keyring.gpg \
29+ && cat /tmp/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
30+ && chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
31+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
32+ && apt-get update \
33+ && apt-get install -y gh \
34+ && rm -rf /var/lib/apt/lists/* \
35+ && git config --global user.email "test@example.com" \
36+ && git config --global user.name "Test User"
37+
38+ RUN rustup default nightly
39+ RUN rustup component add rust-std clippy rustc rustfmt --toolchain nightly
40+
41+ # Copy .git directory into /source
42+ COPY .git /source/.git
43+
44+ # Clone from local source into working directory
45+ WORKDIR /app
46+
47+ RUN git clone --branch main /source /app --local
48+ RUN git remote set-url origin https://github.com/oleander/git-ai.git
49+ RUN cargo fetch
50+ RUN cargo build
51+
52+ # Default command that can be overridden
53+ SHELL ["/bin/bash" , "-lc" ]
54+ CMD ["bash" ]
0 commit comments