Repo to host dev tools useful to automate build, git repo and docker operations
A comprehensive deployment automation script that handles Git operations, Docker builds, and security scanning.
-
Version Management
- Detects current version from git tags and commit messages
- Supports four-part versioning (major.minor.patch.subpatch)
- Interactive version increment selection
- Automatically suggests next version based on increment type
-
Git Operations
- Checks for uncommitted changes
- Generates smart commit messages based on changed files
- Commits and pushes changes using credentials from .deployenv
- Skips git operations if no changes detected
-
Docker Operations
- Uses Docker BuildKit for efficient, modern builds
- Builds Docker image with specified version
- Tags image with both version and 'latest'
- Pushes images to registry using credentials from .deployenv
-
Security
- Advanced sensitive data detection with pattern recognition
- Trufflehog integration for superior secret detection
- Alternative deep scanning when Trufflehog is unavailable
- Displays line numbers for pinpointing sensitive data
- Checks for sensitive files and credentials before commit
- Recommends adding sensitive files to .gitignore
-
Copy the Script
- Add
deploy.shto the root of your project - Make it executable:
chmod +x deploy.sh
- Add
-
Create Environment File
- Create a
.deployenvfile in the same directory with the following variables:DOCKER_USERNAME=your_docker_username DOCKER_PASSWORD=your_docker_password DOCKER_REPO=your_docker_repository GIT_USERNAME=your_git_username GIT_PASSWORD=your_git_password GIT_REPO=your_git_repository - Add
.deployenvto your.gitignore
- Create a
-
Docker Setup
- Ensure you have a
Dockerfilein your project root - The script will build using this Dockerfile
- Ensure you have a
-
Trufflehog (Optional but Recommended)
- Install Trufflehog for enhanced security scanning:
pip install trufflehog - If not installed, the script will use its built-in scanning capabilities
- Install Trufflehog for enhanced security scanning:
Run the script from your project root:
./deploy.shThe script will:
- Check for uncommitted changes
- Scan for sensitive data
- Prompt for version increment type (major/minor/patch/subpatch)
- Generate commit message (or ask for one)
- Perform git operations (commit, push)
- Build and push Docker images
- Credentials: Store all credentials in the
.deployenvfile, not in the script - Scanning: The script performs thorough scanning for sensitive data before commits
- Gitignore: Make sure
.deployenvis in your.gitignore - Sensitive Files: Common sensitive files like
service-account.jsonwill be detected
- Git
- Docker
- Bash
- Trufflehog (optional)
Simply copy both the deploy.sh script and create a .deployenv file in your project root. The script will handle version management, git operations, Docker builds, and security scanning automatically.