Docker Installation
Run CommitWeave in Docker containers and containerized environments
CommitWeave can run in Docker containers, making it perfect for CI/CD pipelines and consistent development environments.
Docker Images
Official Images (Coming Soon)
In Development
Official Docker images are in development and will be available on Docker Hub.
# Coming soon
docker run -it typeweaver/commitweave:latestBuild Your Own
For now, create your own Docker image using this Dockerfile:
FROM node:18-alpine
# Install Git (required for CommitWeave)
RUN apk add --no-cache git
# Install CommitWeave globally
RUN npm install -g @typeweaver/commitweave
# Set working directory
WORKDIR /app
# Copy git repository (mount as volume in practice)
# COPY . .
# Default command
CMD ["commitweave", "--help"]Build the image:
docker build -t commitweave:local .Usage Patterns
Interactive Mode
Run CommitWeave interactively in a container:
# Mount your Git repository
docker run -it --rm \
-v $(pwd):/app \
-v ~/.gitconfig:/root/.gitconfig:ro \
commitweave:local \
commitweave --aiCI/CD Pipeline
Use in automated workflows:
# Non-interactive validation
docker run --rm \
-v $(pwd):/app \
commitweave:local \
commitweave check --format jsonDocker Compose
For development environments, use Docker Compose:
version: '3.8'
services:
commitweave:
build: .
volumes:
- .:/app
- ~/.gitconfig:/root/.gitconfig:ro
- ~/.ssh:/root/.ssh:ro
environment:
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
working_dir: /app
command: commitweave --helpRun with:
docker-compose run --rm commitweave commitweave --aiMulti-Stage Build
For production use, create optimized multi-stage builds:
# Build stage
FROM node:18-alpine AS builder
WORKDIR /build
RUN npm install -g @typeweaver/commitweave
# Runtime stage
FROM node:18-alpine AS runtime
RUN apk add --no-cache git
COPY --from=builder /usr/local/lib/node_modules/@typeweaver/commitweave /usr/local/lib/node_modules/@typeweaver/commitweave
COPY --from=builder /usr/local/bin/commitweave /usr/local/bin/commitweave
WORKDIR /app
CMD ["commitweave"]Environment Variables
Configure CommitWeave using environment variables in containers:
docker run --rm \
-e OPENAI_API_KEY=your-key \
-e ANTHROPIC_API_KEY=your-key \
-e COMMITWEAVE_AI_MODEL=gpt-4 \
-v $(pwd):/app \
commitweave:local \
commitweave --aiKubernetes
Deploy CommitWeave in Kubernetes for team environments:
apiVersion: batch/v1
kind: Job
metadata:
name: commitweave-validation
spec:
template:
spec:
containers:
- name: commitweave
image: commitweave:local
command: ["commitweave", "check"]
env:
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: ai-secrets
key: openai-key
volumeMounts:
- name: repo
mountPath: /app
volumes:
- name: repo
persistentVolumeClaim:
claimName: git-repo-pvc
restartPolicy: NeverGitHub Actions
Use CommitWeave in GitHub Actions with Docker:
name: Validate Commits
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
container:
image: node:18-alpine
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Git
run: apk add --no-cache git
- name: Install CommitWeave
run: npm install -g @typeweaver/commitweave
- name: Validate Commits
run: commitweave check
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}Volume Mounts
Important directories to mount:
docker run -it --rm \
-v $(pwd):/app \
-v ~/.gitconfig:/root/.gitconfig:ro \
-v ~/.ssh:/root/.ssh:ro \
-v ~/.commitweave:/root/.commitweave \
commitweave:localSecurity Considerations
API Keys
Never embed API keys in Docker images:
Security Warning
Always use environment variables or secrets management for API keys, never bake them into Docker images.
# ✅ Good - environment variables
docker run -e OPENAI_API_KEY=${OPENAI_API_KEY} commitweave:local
# ❌ Bad - embedded in image
ENV OPENAI_API_KEY=sk-your-key-hereSSH Keys
Mount SSH keys as read-only:
-v ~/.ssh:/root/.ssh:roGit Configuration
Use read-only mounts for Git config:
-v ~/.gitconfig:/root/.gitconfig:roTroubleshooting
Git Repository Not Found
Ensure you mount the repository correctly:
# Check if .git directory exists in container
docker run --rm -v $(pwd):/app commitweave:local ls -la /appPermission Issues
Fix file permissions between host and container:
# Match user IDs
docker run --user $(id -u):$(id -g) ...
# Or fix permissions after
docker run --rm -v $(pwd):/app alpine chown -R $(id -u):$(id -g) /appMemory Limits
For large repositories, increase memory limits:
docker run --memory=2g --memory-swap=4g commitweave:localPerformance Tips
- Layer Caching: Structure Dockerfile to cache npm install
- Multi-stage Builds: Reduce final image size
- Alpine Images: Use Alpine Linux for smaller images
- Volume Caching: Cache node_modules between runs
# Cache npm dependencies
COPY package*.json ./
RUN npm ci --only=production
# Copy application code
COPY . .This Docker setup provides a consistent, reproducible environment for running CommitWeave across different platforms and CI/CD systems.