No description
  • Dockerfile 100%
Find a file
Maciej Lebiest cbd5bdc350
All checks were successful
Build image / build-amd64 (push) Successful in 1m47s
Build image / build-arm64 (push) Successful in 6m53s
Build image / update-images-manifests (push) Successful in 7s
basic project setup
2026-03-16 18:46:53 +01:00
.forgejo/workflows basic project setup 2026-03-16 18:46:53 +01:00
.dockerignore basic project setup 2026-03-16 18:46:53 +01:00
AGENTS.md basic project setup 2026-03-16 18:46:53 +01:00
Containerfile basic project setup 2026-03-16 18:46:53 +01:00
LICENSE Initial commit 2026-03-16 16:45:42 +00:00
README.md basic project setup 2026-03-16 18:46:53 +01:00

OpenCode Container

This project provides a containerized setup for opencode, an AI-powered coding assistant.

Building the Image

podman build -t opencode .
# or
docker build -t opencode .

Running OpenCode in a Container

Add this function to your .bashrc or .zshrc:

opencode() {
    local image="opencode"
    local MOUNT_FILE=()

    local opencode_data_dir="$HOME/.local/share/opencode"
    if [ ! -d "$opencode_data_dir" ]; then
        mkdir -p "$opencode_data_dir"
    fi

    for arg in "$@"; do
        if [ -f "$arg" ] || [ -d "$arg" ]; then
            MOUNT_FILE+=(-v "$arg:$arg:rw")
            echo "Mounting $arg"
        fi
    done

    if [ -z "${MOUNT_FILE[*]}" ]; then
        local base_path="$(pwd)"
        MOUNT_FILE=(--workdir "/data$base_path" -v "$base_path:/data$base_path:rw")
    fi

    MOUNT_FILE+=(-v "$opencode_data_dir:/root/.local/share/opencode:rw")

    echo "Files mount options: "${MOUNT_FILE[*]}""

    podman run --privileged -it --rm $PODMAN_FLAGS \
        --log-driver none \
        --shm-size=0 \
        --init \
        --network host \
        "${MOUNT_FILE[@]}" \
        "$image" \
        "$@"
}

Usage

opencode --help
opencode "your prompt here"
opencode /path/to/file.py
opencode auth login

The function mounts your current working directory (or specific files) into the container, allowing opencode to access and edit files in your project.