Created
August 18, 2026 11:27
-
-
Save thimslugga/da6655fdc003bc7676ab9db674072eed to your computer and use it in GitHub Desktop.
Agents Container Images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # syntax=docker/dockerfile:1 | |
| # Download, build, and run: | |
| # curl -fsSL https://gist.githubusercontent.com/nikarh/6381b3d43eb92b2479f06482fbf8e02f/raw/Dockerfile -o /tmp/Dockerfile && docker build --build-arg UID="$(id -u)" --build-arg GID="$(id -g)" --build-arg USERNAME="${USER:-dev}" -t agents:latest -f /tmp/Dockerfile /tmp && docker run --name agent -it -v "$(pwd):/workspace" -e GIT_AUTHOR_NAME="$(git config --get user.name)" -e GIT_AUTHOR_EMAIL="$(git config --get user.email)" -e GIT_COMMITTER_NAME="$(git config --get user.name)" -e GIT_COMMITTER_EMAIL="$(git config --get user.email)" agents:latest | |
| FROM archlinux:latest | |
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | |
| ARG UID=1000 | |
| ARG GID=1000 | |
| ARG USERNAME=dev | |
| # Base tools + Node.js + Go + Rust + fd + ripgrep + socat | |
| RUN pacman -Syu --noconfirm \ | |
| && pacman -S --noconfirm --needed \ | |
| base-devel \ | |
| ca-certificates \ | |
| sudo \ | |
| curl \ | |
| jq \ | |
| git \ | |
| nodejs \ | |
| npm \ | |
| go \ | |
| clang \ | |
| gcc \ | |
| rustup \ | |
| fd \ | |
| ripgrep \ | |
| socat \ | |
| && pacman -Scc --noconfirm | |
| # Initialize stable Rust toolchain | |
| RUN rustup default stable | |
| # Create requested user/group and grant passwordless sudo | |
| RUN set -eux \ | |
| && if ! getent group "${GID}" >/dev/null; then \ | |
| groupadd -g "${GID}" "${USERNAME}"; \ | |
| fi \ | |
| && GROUP_NAME="$(getent group "${GID}" | cut -d: -f1)" \ | |
| && if ! getent passwd "${UID}" >/dev/null; then \ | |
| useradd -m -u "${UID}" -g "${GID}" -s /bin/bash "${USERNAME}"; \ | |
| fi \ | |
| && USER_NAME="$(getent passwd "${UID}" | cut -d: -f1)" \ | |
| && HOME_DIR="$(getent passwd "${UID}" | cut -d: -f6)" \ | |
| && install -d -o "${UID}" -g "${GID}" "${HOME_DIR}" \ | |
| && echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-agent-user \ | |
| && chmod 0440 /etc/sudoers.d/90-agent-user | |
| # Single source file in the user's home, symlinked to each tool's global location | |
| RUN USER_NAME="$(getent passwd "${UID}" | cut -d: -f1)" \ | |
| && HOME_DIR="$(getent passwd "${UID}" | cut -d: -f6)" \ | |
| && install -d -o "${UID}" -g "${GID}" "${HOME_DIR}" \ | |
| && cat > "${HOME_DIR}/AGENTS.md" <<'EOF' | |
| You are running in an isolated container | |
| based off Fedora Linux and passwordless sudo. | |
| Install any system packages/tools/compilers missing. | |
| When adding dependencies to the project don't edit files - use package managers to always get the latest version. | |
| Use conventional commits. Split logical changes to individual commits. | |
| EOF | |
| RUN chown "${UID}:${GID}" "$(getent passwd "${UID}" | cut -d: -f6)/AGENTS.md" | |
| RUN HOME_DIR="$(getent passwd "${UID}" | cut -d: -f6)" \ | |
| && install -d -o "${UID}" -g "${GID}" \ | |
| "${HOME_DIR}/.codex" \ | |
| "${HOME_DIR}/.claude" \ | |
| "${HOME_DIR}/.gemini" \ | |
| "${HOME_DIR}/.cursor/rules" \ | |
| && ln -sf "${HOME_DIR}/AGENTS.md" "${HOME_DIR}/.codex/AGENTS.md" \ | |
| && ln -sf "${HOME_DIR}/AGENTS.md" "${HOME_DIR}/.claude/CLAUDE.md" \ | |
| && ln -sf "${HOME_DIR}/AGENTS.md" "${HOME_DIR}/.gemini/GEMINI.md" \ | |
| && ln -sf "${HOME_DIR}/AGENTS.md" "${HOME_DIR}/.cursor/rules/AGENTS.md" \ | |
| && chown -h "${UID}:${GID}" \ | |
| "${HOME_DIR}/.codex/AGENTS.md" \ | |
| "${HOME_DIR}/.claude/CLAUDE.md" \ | |
| "${HOME_DIR}/.gemini/GEMINI.md" \ | |
| "${HOME_DIR}/.cursor/rules/AGENTS.md" | |
| # Global CLIs as target user | |
| RUN USER_NAME="$(getent passwd "${UID}" | cut -d: -f1)" \ | |
| && su - "${USER_NAME}" -c 'mkdir -p "$HOME/.npm-global" && npm config set prefix "$HOME/.npm-global"' \ | |
| && su - "${USER_NAME}" -c 'npm install -g @openai/codex @anthropic-ai/claude-code @google/gemini-cli' \ | |
| && su - "${USER_NAME}" -c 'npm cache clean --force' | |
| # Cursor Agent CLI as target user | |
| RUN USER_NAME="$(getent passwd "${UID}" | cut -d: -f1)" \ | |
| && su - "${USER_NAME}" -c 'curl https://cursor.com/install -fsS | bash' \ | |
| && su - "${USER_NAME}" -c '$HOME/.local/bin/agent --version || $HOME/.local/bin/cursor-agent --version' | |
| # Configure user PATH for rust + npm-global + Cursor Agent | |
| RUN USER_NAME="$(getent passwd "${UID}" | cut -d: -f1)" \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.cargo/bin" "$HOME/.profile" 2>/dev/null || echo "export PATH=\$HOME/.cargo/bin:\$PATH" >> "$HOME/.profile"' \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.npm-global/bin" "$HOME/.profile" 2>/dev/null || echo "export PATH=\$HOME/.npm-global/bin:\$PATH" >> "$HOME/.profile"' \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.local/bin" "$HOME/.profile" 2>/dev/null || echo "export PATH=\$HOME/.local/bin:\$PATH" >> "$HOME/.profile"' \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.cargo/bin" "$HOME/.bashrc" 2>/dev/null || echo "export PATH=\$HOME/.cargo/bin:\$PATH" >> "$HOME/.bashrc"' \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.npm-global/bin" "$HOME/.bashrc" 2>/dev/null || echo "export PATH=\$HOME/.npm-global/bin:\$PATH" >> "$HOME/.bashrc"' \ | |
| && su - "${USER_NAME}" -c 'grep -q "\.local/bin" "$HOME/.bashrc" 2>/dev/null || echo "export PATH=\$HOME/.local/bin:\$PATH" >> "$HOME/.bashrc"' | |
| ENV PATH="/home/${USERNAME}/.local/bin:/home/${USERNAME}/.npm-global/bin:/home/${USERNAME}/.cargo/bin:${PATH}" | |
| USER ${UID}:${GID} | |
| WORKDIR /workspace | |
| CMD ["/bin/bash"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment