β οΈ Work in Progress (WIP) This repository is currently under active development. Templates, documentation, and build processes are being refined. Expect frequent changes and potential breaking updates. Use in production environments at your own discretion.
This repository contains Coder workspace templates for various development environments. Each template provides a complete, pre-configured development environment that can be deployed on Kubernetes through the Coder platform.
This repository uses Dagger for building Docker images with a modern, programmable CI/CD pipeline written in Go.
-
Dagger CLI: Install Dagger on your local machine
# macOS brew install dagger/tap/dagger # Linux curl -L https://dl.dagger.io/dagger/install.sh | sh # Windows (PowerShell) iwr https://dl.dagger.io/dagger/install.ps1 -useb | iex
-
Docker: Ensure Docker is running for local builds
-
Registry Access: For publishing images, ensure you have access to your target registry
-
Environment Variables: Set required credentials
export DOCKER_PASSWORD="your-docker-hub-password-or-token" export CODER_TOKEN="your-coder-api-token"
The main build command builds Docker images, pushes to Docker Hub, and uploads templates to your Coder instance:
dagger call build-pipeline \
--cluster-name="developer" \
--source=./riksarkivet-developer-template \
--docker-password=env:DOCKER_PASSWORD \
--docker-username=airiksarkivet \
--image-repository=riksarkivet/workspace-developer \
--image-tag=v1.0.0 \
--preset "Small Development" \
--coder-url=http://coder.coder.svc.cluster.local \
--coder-token=env:CODER_TOKEN \
--template-name="Riksarkivets-Developer-Template" \
--template-params "dotfiles_uri=https://github.com/AI-Riksarkivet/dotfiles" \
--template-params "AI Prompt=" \
--env-vars="ENABLE_CUDA=false"This command will:
- Build the Docker image with the specified parameters
- Push the image to Docker Hub
- Upload the template to your Coder instance with the new image reference
Required Parameters:
--cluster-name: K3s cluster name for local testing--source: Local directory containing the template (e.g.,./riksarkivet-developer-template)--docker-username: Docker Hub username for image pushing--docker-password: Docker Hub password/token (useenv:DOCKER_PASSWORD)--image-repository: Repository name (e.g.,riksarkivet/workspace-developer)--image-tag: Version tag for the image (e.g.,v1.0.0)--template-name: Display name in Coder (max 32 characters)
Coder Integration (Optional):
--coder-url: Coder server URL (use internal DNS when running in cluster)--coder-token: Coder API token (useenv:CODER_TOKEN)
Customization:
--preset: Coder preset to use for testing (e.g.,"Small Development")--template-params: Template parameters inKEY=VALUEformat (can be repeated)--env-vars: Build environment variables inKEY=VALUEformat (can be repeated)
# Login to your Coder instance
coder login http://your-coder-url
# Create a token with 1 year lifetime
coder tokens create --lifetime 168h --name "build-pipeline"
# Set as environment variable
export CODER_TOKEN="your-token-here"Configure builds using these environment variables:
| Variable | Description | Default |
|---|---|---|
ENABLE_CUDA |
Enable GPU/CUDA support (true/false) |
false |
PYTHON_VERSION |
Python version to install | 3.12 |
Note: When ENABLE_CUDA=false, the function automatically appends -cpu to the image tag.
Location: riksarkivet-developer-template/
A comprehensive development environment optimized for the "Small Development" preset:
- Base: Ubuntu 22.04 with conditional CUDA support
- Resources: Optimized for 2 CPU, 4GB RAM, 10GB storage
- Volume Mounts: Conditionally mounts scratch and work volumes (skipped for small-dev preset)
- AI Integration: Claude Code and development tools
- Modern Shell: Starship prompt with Git integration
Best for: General development, CI/CD, lightweight development workflows
-
Set Environment Variables:
export DOCKER_PASSWORD="your-docker-hub-token" export CODER_TOKEN="your-coder-api-token"
-
Build and Deploy:
dagger call build-pipeline \ --cluster-name="developer" \ --source=./riksarkivet-developer-template \ --docker-password=env:DOCKER_PASSWORD \ --docker-username=your-username \ --image-repository=your-org/workspace-developer \ --image-tag=v1.0.0 \ --coder-url=http://your-coder-server \ --coder-token=env:CODER_TOKEN \ --template-name="Your Template Name" \ --env-vars="ENABLE_CUDA=false"
-
Access Template: The template will be automatically uploaded to your Coder instance and ready for workspace creation.
This repository integrates with Argo Workflows to provide automated CI/CD pipeline capabilities for building and deploying Coder templates. Argo Workflows is a container-native workflow engine for orchestrating parallel jobs on Kubernetes.
Argo Workflows is an open-source, cloud-native workflow engine for Kubernetes that enables:
- Container-native workflows: Each step runs in its own container
- Complex dependencies: DAG-based workflow orchestration
- Scalable execution: Native Kubernetes resource management
- Rich UI: Web-based workflow visualization and monitoring
The repository contains Argo Workflow configurations in multiple locations:
workflow-template.yaml: Reusable WorkflowTemplate for manual buildssecrets-example.yaml: Example secret configurations for authentication
Each template directory contains its own Argo configurations:
riksarkivet-developer-template/argo-workflows/:cron-workflow-cpu.yaml: Nightly CPU-only builds (2 AM UTC)cron-workflow-gpu.yaml: Nightly GPU-enabled builds (2 AM UTC)
riksarkivet-agent-template/argo-workflows/:cron-workflow-cpu.yaml: Agent template CPU buildscron-workflow-gpu.yaml: Agent template GPU builds
Automated Scheduling: CronWorkflows run nightly builds with timestamped tags:
schedule: "0 2 * * *" # 2 AM UTC daily
image-tag: "nightly-{{workflow.creationTimestamp.Y}}-{{workflow.creationTimestamp.m}}-{{workflow.creationTimestamp.d}}"Dagger Integration: Uses Dagger engine sidecar for containerized builds:
- Privileged execution for Docker-in-Docker
- Persistent volume claims for build caching
- GPU support for CUDA-enabled builds
Multi-Environment Support:
- Separate CPU and GPU build variants
- Configurable presets and parameters
- Environment-specific image tagging
-
Argo Workflows Installation: Deploy Argo Workflows on your Kubernetes cluster
kubectl create namespace argo kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v3.5.4/install.yaml
-
Required Secrets: Configure the following Kubernetes secrets in your
cinamespace:docker-registry-credentials: Docker Hub authenticationcoder-credentials: Coder server access credentialsgithub-credentials: GitHub access token for repository accessdagger-cloud-token: (Optional) Dagger Cloud integration
-
Service Account: Ensure proper RBAC permissions for the
ci-service-account -
Namespace: Workflows run in the
cinamespace by default
Trigger manual builds using the Argo CLI or UI:
# Using Argo CLI
argo submit argo-workflows/workflow-template.yaml \
--parameter image-tag=manual-v1.0.1 \
--parameter template-name="Manual-Build" \
-n ci
# Using kubectl
kubectl create -f argo-workflows/workflow-template.yaml -n ciArgo UI: Access the workflow dashboard at https://your-argo-server/workflows
Workflow Status: Monitor workflow execution:
argo list -n ci
argo get <workflow-name> -n ci
argo logs <workflow-name> -n ciCommon Issues:
- Secret Access: Verify all required secrets exist in the
cinamespace - Storage: Ensure sufficient PVC storage for Dagger builds (10Gi default)
- Permissions: Check service account has necessary RBAC permissions
- Resource Limits: Monitor CPU/memory usage during parallel builds
- Coder Documentation: Official Coder platform documentation
- Dagger Documentation: Dagger build system documentation
- Argo Workflows Documentation: Complete Argo Workflows guide
- Argo Workflows GitHub: Official Argo Workflows repository
- Template-Specific Docs: See individual template directories for detailed documentation
- Fork Repository: Create your own fork for changes
- Follow Conventions: Maintain the established directory and documentation structure
- Test Changes: Verify builds and deployments work correctly
- Update Documentation: Ensure all changes are documented
- Submit PR: Create pull request with clear description
For issues and questions:
- Build Issues: Review Dagger logs and configuration
- Coder Integration: Check your Coder server connectivity and token
- Repository Issues: Create GitHub issues with detailed descriptions