A modern Go application for running Linux containers with intelligent directory mounting and git repository awareness.
- π Smart Mounting: Automatic mounting of current working directory
- π¦ Git Integration: Discovers and mounts git repositories automatically
- π Script Support: Execute UP script files with shebang-style invocation
- π§ Interactive Mode: TTY support for interactive container sessions
- ποΈ Custom Volumes: Flexible volume mounting with read-only support
- π Network Modes: Configure container networking (bridge, host, none)
- β‘ Modern Architecture: Built following Go best practices with clean separation of concerns
# Build from source
make build
# Install to $GOPATH/bin
go install ./cmd/vsl# Run a command in Ubuntu container
vsl run --image ubuntu:latest -- echo "Hello World"
# Interactive shell
vsl run --image alpine:latest --interactive
# With custom working directory
vsl run --image node:latest --working-dir /app -- npm testBy default, vsl automatically discovers git repositories and mounts them:
# Automatically mounts git repo
vsl run --image golang:latest -- go test ./...
# Disable git discovery
vsl run --image node:latest --no-git -- npm test# Mount additional volumes
vsl run --image postgres:latest \
--volume /data:/var/lib/postgresql/data \
--volume ~/.config:/root/.config:ro
# Multiple environment variables
vsl run --image redis:latest \
--env REDIS_PORT=6379 \
--env REDIS_PASSWORD=secretCreate executable UP script files:
#!/usr/bin/env vsl
image ubuntu:latest
command ["echo", "Hello from script"]
working_dir /workspace
environment {
MY_VAR value1
ANOTHER another_value
}
volumes [
"~/.config:/root/.config:ro"
]
stdin_open true
tty true
Make it executable and run:
chmod +x my-script.up
./my-script.up arg1 arg2This project follows modern Go application architecture patterns:
cmd/vsl/ # Application entry point
βββ main.go # Minimal main with signal handling
internal/
βββ app/ # Application framework
β βββ action.go # Generic action handlers
β βββ flags.go # Reusable flag helpers
β βββ output.go # Output formatting
β βββ types.go # Common types
β βββ log/ # Logging configuration
β βββ commands/ # CLI command structure
β βββ run/ # Run command implementation
β
βββ container/ # Container domain
β βββ types.go # Domain types (strongly typed)
β βββ run/ # Run business logic
β βββ config.go # Configuration struct
β βββ run.go # Implementation
β
βββ git/ # Git utilities
β βββ discovery.go # Repository discovery
β
βββ mount/ # Mount utilities
β βββ parser.go # Volume parsing
β
βββ script/ # Script parsing
βββ parser.go # UP file parser
- Strong Typing: Domain concepts use custom types (e.g.,
container.Image,container.WorkingDir) - Separation of Concerns: Clear boundaries between CLI, business logic, and utilities
- Generic Actions: Reusable action handlers with generics for type safety
- Dependency Injection: Functions accept dependencies for easy testing
- Structured Logging: slog-based structured logging throughout
- Environment Variables: All flags support environment variable configuration
make build # Build all binaries
make build-release # Build optimized release binaries
make build-debug # Build with debugging symbolsmake test # Run unit tests
make test-all # Run all tests
make test-integration # Run integration testsmake lint # Run linter
make check # Run tests, linters, and API compatibility checks
make gorelease # Check API compatibilityAll development tools are managed via go.mod tool directives:
golangci-lint- Comprehensive lintergotestsum- Enhanced test runnergorelease- API compatibility checkergqlgen- GraphQL code generatorbuf- Protocol buffer toolingmga- Code generation
All configuration can be set via environment variables with VSL_ prefix:
# Logging
export VSL_LOG_LEVEL=debug
export VSL_LOG_FORMAT=json
# Run command
export VSL_RUN_IMAGE=ubuntu:latest
export VSL_RUN_NO_GIT=true
export VSL_RUN_INTERACTIVE=falseCommand-line flags override environment variables:
vsl --log-level debug run --image alpine:latest --no-gitMIT License - see LICENSE file for details
Architecture inspired by modern-go-application standards.