Skip to content

Commit 8e7d440

Browse files
authored
Add agentic workflow
1 parent eeb0921 commit 8e7d440

3 files changed

Lines changed: 81 additions & 8 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,49 @@
1-
FROM python:3.12-slim
1+
FROM ubuntu:24.04
22

3-
# Install essential packages and create non-root user
4-
RUN apt-get update && apt-get install -y --no-install-recommends git curl sudo bash-completion vim \
5-
&& useradd -m -s /bin/bash vscode \
3+
# Install gcc, clang and some supporting tools for downloading/installing later tools.
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
bash-completion \
6+
cmake \
7+
curl \
8+
g++ \
9+
gdb \
10+
git \
11+
gpg \
12+
lcov \
13+
llvm \
14+
ninja-build \
15+
python-is-python3 \
16+
python3-pip \
17+
python3-venv \
18+
software-properties-common \
19+
ssh \
20+
sudo \
21+
unzip \
22+
vim \
23+
wget \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
# Install bazelisk.
27+
RUN ARCH=$(dpkg --print-architecture) && \
28+
wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-${ARCH} -O /usr/local/bin/bazelisk \
29+
&& chmod +x /usr/local/bin/bazelisk \
30+
&& ln -s /usr/local/bin/bazelisk /usr/local/bin/bazel
31+
32+
# Create non-root user and add to sudoers
33+
RUN useradd -m -s /bin/bash vscode \
634
&& echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
735
&& mkdir -p /workspace \
8-
&& chown vscode:vscode /workspace \
36+
&& chown vscode:vscode /workspace
37+
38+
# Install Node.js (required for Gemini CLI)
39+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
40+
&& apt-get install -y --no-install-recommends nodejs \
941
&& rm -rf /var/lib/apt/lists/*
1042

43+
# Install Gemini CLI globally
44+
RUN npm install -g @google/gemini-cli \
45+
&& npm cache clean --force
46+
1147
WORKDIR /workspace
1248

1349
# Switch to non-root user
@@ -21,4 +57,10 @@ RUN echo 'source /usr/share/bash-completion/completions/git' >> ~/.bashrc \
2157
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
2258

2359
# Set up environment variables
24-
ENV PATH="/home/vscode/.local/bin:${PATH}"
60+
ENV PATH="/home/vscode/.local/bin:/usr/local/bin:${PATH}"
61+
ENV UV_PROJECT_ENVIRONMENT="/home/vscode/.venv"
62+
63+
# Pre-configure Gemini CLI
64+
RUN mkdir -p /home/vscode/.gemini \
65+
&& echo '{"/workspace": "TRUST_FOLDER"}' > /home/vscode/.gemini/trustedFolders.json \
66+
&& echo '{"security": {"auth": {"selectedType": "gemini-api-key"}}}' > /home/vscode/.gemini/settings.json

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"ms-toolsai.jupyter-renderers",
1818
"ms-toolsai.jupyter",
1919
"ms-toolsai.vscode-jupyter-cell-tags",
20-
"ms-toolsai.vscode-jupyter-slideshow",
20+
"ms-toolsai.vscode-jupyter-slideshow"
2121
],
2222
"settings": {
23-
"python.defaultInterpreterPath": "/${workspaceFolder}/.venv/bin/python",
23+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
2424
"[python]": {
2525
"editor.defaultFormatter": "charliermarsh.ruff",
2626
"editor.formatOnSave": true,

scripts/gemini-sandbox.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# Exit on error
4+
set -euo pipefail
5+
6+
# Check if GEMINI_API_KEY is set
7+
if [ -z "${GEMINI_API_KEY:-}" ]; then
8+
echo "Error: GEMINI_API_KEY environment variable is not set."
9+
echo "Please set it before running this script:"
10+
echo " export GEMINI_API_KEY='your_api_key_here'"
11+
exit 1
12+
fi
13+
14+
IMAGE_NAME="py-cppmodel-sandbox"
15+
DOCKERFILE=".devcontainer/Dockerfile"
16+
17+
# Build the image
18+
echo "--- Building Docker Sandbox: $IMAGE_NAME ---"
19+
docker build -t "$IMAGE_NAME" -f "$DOCKERFILE" .
20+
21+
# Run the container
22+
echo "--- Starting Sandboxed Gemini Session ---"
23+
echo "Note: Your current directory $(pwd) is mounted to /workspace"
24+
25+
docker run -it --rm \
26+
-v "$(pwd):/workspace" \
27+
-e GEMINI_API_KEY="$GEMINI_API_KEY" \
28+
-e TERM=${TERM:-} \
29+
-e COLORTERM=${COLORTERM:-} \
30+
"$IMAGE_NAME" \
31+
gemini

0 commit comments

Comments
 (0)