Deployment
Deploy with CLI (Local)
You can deploy directly from your local machine using the dockflow deploy command:
# Deploy to production with version 1.0.0
dockflow deploy production 1.0.0
# Deploy to staging (auto-generated version)
dockflow deploy staging
# Deploy to production with specific hostname
dockflow deploy production 2.0.0 --hostname server1Using Docker Image
If you prefer using the Docker image instead of installing the CLI:
Linux / macOS
# Deploy to production with version 1.0.0
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/project shawiizz/dockflow-cli:latest deploy production 1.0.0
# Deploy to staging
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -v .:/project shawiizz/dockflow-cli:latest deploy stagingNote: The Docker socket mount is required for the
deploycommand. It enables Docker-in-Docker, allowing the CLI to build Docker images locally before transferring them to your server.
Prerequisites
Install Dockflow CLI
curl -fsSL "https://raw.githubusercontent.com/Shawiizz/dockflow/main/cli/cli_wrapper.sh?$(date +%s)" | bashCreate .env.dockflow file
Create this file in your project root:
# Production connection string (from setup-machine output)
PRODUCTION_CONNECTION=eyJob3N0Ijoi...
# Staging connection string (optional)
STAGING_CONNECTION=eyJob3N0Ijoi...
# Skip Docker installation on target (optional)
SKIP_DOCKER_INSTALL=trueā ļø Important: Add
.env.dockflowto your.gitignoreto avoid exposing secrets.
Initialize project structure
If not already done:
dockflow initDeploy with Git Tags
# Production deployment
git tag 1.0.0
git push origin --tags
# Staging deployment
git tag 1.0.0-staging
git push origin --tags
# Custom environment
git tag 1.0.0-whatever
git push origin --tagsDeploy on Branch Push
Before using, you need to configure your Github/GitLab workflow.
You can also trigger deployments on direct branch pushes (deploys to production):
git push origin mainWhat Happens During Deployment
- Build - Docker images are built (locally or remotely)
- Transfer - Images/code sent to target servers
- Deploy - Ansible orchestrates the deployment
- Done - Your app is live!
CI/CD Jobs Available:
build- Validates Docker builds on every pushdeploy- Deploys when you push a tag