# Taskfile Build

Docker pulls

The Taskfile Build Docker image runs any project.

Source: https://git.taskfile.build/src/branch/main/image

# Usage

Setup environment variables:

export GIT_URL="https://git.taskfile.build"
export TASK_COMMANDS="install,build"
export CADDY_ROOT="_site"

Run the Taskfile Build image:

run-container() {
    container_name="taskfile-build"
    image_tag="mintsystem/taskfile.build:latest"

    docker pull "$image_tag"
    docker rm -f "$container_name"
    docker volume rm "$container_name"

    echo "Open http://localhost:8080 in your browser"
    docker run -p 8080:80 -d \
        --name "$container_name" \
        -e GIT_URL="https://git.taskfile.build" \
        -e TASK_COMMANDS="install,build-11ty" \
        -e CADDY_ROOT="_site" \
        -v "$container_name":/app \
        "$image_tag"
}

The entrypoint script of the container will clone the project from GIT_URL to /app/repo. If the project is already cloned it will pull from origin. Afterwards it runs each TASK_COMMANDS in the root of the cloned repository with the task file ./task <command>. Finally by default the Caddy webserver is started that serves static content from the CADDY_ROOT path.

# OpenCode

The image includes the OpenCode CLI installed via pnpm.

The OpenCode config is stored under /app/.config/opencode/ inside the container. Since /app is mounted as a Docker volume in the example above, the OpenCode config is already persisted alongside the project.