Skip to content

Instantly share code, notes, and snippets.

@Nithanim
Last active December 28, 2025 15:27
Show Gist options
  • Select an option

  • Save Nithanim/f8ec12c11179a32cf2bf14fc04a1dcc8 to your computer and use it in GitHub Desktop.

Select an option

Save Nithanim/f8ec12c11179a32cf2bf14fc04a1dcc8 to your computer and use it in GitHub Desktop.
Opencode Docker Simple Sandbox
services:
dev-env:
build: .
volumes:
- ~/project/:/workspace # Your project folder
- ~/.config/opencode:/root/.config/opencode:ro # Your config (read-only)
- ~/.local/share/opencode/:/root/.local/share/opencode/
- dev-tools:/opt/tools # Persistent volume for installed tools
- dev-cache:/root/.cache # Cache for package managers
# - dev-cache-maven:/root/.m2
working_dir: /workspace
stdin_open: true
tty: true
command: /bin/bash
volumes:
dev-tools:
dev-cache:
FROM ubuntu:22.04
# Install essentials
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
build-essential \
python3 \
python3-pip \
sudo
# && rm -rf /var/lib/apt/lists/*
ENV NVM_VERSION=0.40.3
ENV NODE_VERSION=22.18.0
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash
# standard location
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN apt-get install -y openjdk-21-jdk-headless maven
RUN npm i -g opencode-ai@1.0.134
#RUN npm i -g @openai/codex
# Add tools directory to PATH
ENV PATH="/opt/tools/bin:${PATH}"
# Allow installing packages without prompts
#ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment