Docker
Varlock provides an official Docker image for use in containerized environments and CI/CD pipelines. The image is hosted on GitHub Container Registry (GHCR) and makes it easy to integrate varlock into your Docker workflows and ensures consistent behavior across different environments.
Quick Start
Section titled “Quick Start”# Pull the latest versiondocker pull ghcr.io/dmno-dev/varlock:latest
# Run varlock helpdocker run --rm ghcr.io/dmno-dev/varlock:latest --help
# Run varlock load in a directorydocker run --rm -v $(pwd):/work -w /work -e PWD=/work ghcr.io/dmno-dev/varlock:latest load
Available Tags
Section titled “Available Tags”ghcr.io/dmno-dev/varlock:latest
- Latest stable releaseghcr.io/dmno-dev/varlock:1.2.3
- Specific version (replace with actual version)
Usage Examples
Section titled “Usage Examples”Basic Usage
Section titled “Basic Usage”# Validate and load environment variablesdocker run --rm -v $(pwd):/work -w /work -e PWD=/work ghcr.io/dmno-dev/varlock:latest load
# Run a command with loaded environment variablesdocker run --rm -v $(pwd):/work -w /work -e PWD=/work ghcr.io/dmno-dev/varlock:latest run -- node app.js
CI/CD Pipeline
Section titled “CI/CD Pipeline”# GitHub Actions example- name: Validate environment schema run: | docker run --rm \ -v ${{ github.workspace }}:/work \ -w /work \ -e PWD=/work \ ghcr.io/dmno-dev/varlock:latest load
Multi-stage Docker Builds
Section titled “Multi-stage Docker Builds”Use varlock in multi-stage builds to copy the binary into your application:
# Use varlock in a multi-stage buildFROM ghcr.io/dmno-dev/varlock:latest AS varlock
FROM node:18-alpineCOPY --from=varlock /usr/local/bin/varlock /usr/local/bin/varlock
# Now varlock is available in your application containerRUN varlock --help
Docker Compose
Section titled “Docker Compose”version: '3.8'services: app: build: . environment: - NODE_ENV=production volumes: - .:/app - /app/node_modules command: ["varlock", "run", "--", "node", "app.js"]
Security
Section titled “Security”The Docker image is built from the official varlock binary releases and includes:
- Minimal Alpine Linux base for reduced attack surface
- Non-root user execution (when possible)
- Regular security updates through Alpine package updates
Troubleshooting
Section titled “Troubleshooting”Permission Issues
Section titled “Permission Issues”If you encounter permission issues when mounting volumes:
# Run with appropriate user permissionsdocker run --rm -u $(id -u):$(id -g) -v $(pwd):/work -w /work -e PWD=/work ghcr.io/dmno-dev/varlock:latest load
### Network Issues
If you need to access external services (like 1Password CLI):
```bash# Pass through host networkdocker run --rm --network host -v $(pwd):/work -w /work -e PWD=/work ghcr.io/dmno-dev/varlock:latest load
## Building Locally
To build the Docker image locally:
```bash# Build with specific versiondocker build --build-arg VARLOCK_VERSION=1.2.3 -t varlock:local .
# Build with latest versiondocker build --build-arg VARLOCK_VERSION=latest -t varlock:local .