Command Line Tools
wheels docker build
wheels docker build
Section titled “wheels docker build”Unified Docker build command for Wheels apps. Builds Docker images locally or on remote servers.
Synopsis
Section titled “Synopsis”wheels docker build [options]Description
Section titled “Description”The wheels docker build command handles the building of Docker images for your application. It can build images on your local machine or trigger builds on configured remote servers.
Centralized Configuration:
- Source of Truth: This command prioritizes settings from
config/deploy.ymlfor server lists and image repository names. - Strategy Detection: It automatically detects if you are using a
docker-compose.ymlfile or a standaloneDockerfileand adjusts its build strategy accordingly.
Options
Section titled “Options”| Option | Description | Default |
|---|---|---|
--local | Build Docker image on local machine | false |
--remote | Build Docker image on remote server(s) | false |
--servers | Comma-separated list of server numbers to build on (e.g., “1,3,5”) - for remote only | "" |
--tag | Custom tag for the Docker image (default: project-name:latest) | "" |
--nocache | Build without using cache | false |
--pull | Always attempt to pull a newer version of the base image | false |
Detailed Examples
Section titled “Detailed Examples”Local Development Builds
Section titled “Local Development Builds”Standard Build
Builds the image using the Dockerfile in the current directory. Tags it with the folder name (e.g., my-app:latest).
wheels docker build --localForce Rebuild
If you’ve changed base image dependencies or want to ensure a clean build, use --nocache and --pull.
wheels docker build --local --nocache --pullCustom Tagging Useful when building specific versions for release.
wheels docker build --local --tag=my-company/my-app:v2.0.0Remote Server Builds
Section titled “Remote Server Builds”Build on All Servers
Triggers the build process on every server listed in your config/deploy.yml (or legacy deploy-servers.txt/deploy-servers.json).
wheels docker build --remoteBuild on Specific Servers Useful if you want to update only a subset of servers (e.g., only the staging servers).
# Build only on the first and third server defined in your configwheels docker build --remote --servers=1,3Remote Build with Cache Busting Forces the remote servers to pull fresh base images and ignore build cache.
wheels docker build --remote --nocache --pullHow It Works
Section titled “How It Works”Local Build Strategy (--local)
Section titled “Local Build Strategy (--local)”- Prerequisite Check: Verifies that Docker is installed and running.
- Compose Detection:
- If
docker-compose.ymlexists: It executesdocker compose build. This is ideal for complex apps with multiple services (app, db, redis). - If only
Dockerfileexists: It executesdocker build -t [tag] ..
- If
- Tagging: If no custom tag is provided, it sanitizes the current directory name to create a valid Docker tag (e.g.,
My Project->my-project:latest).
Remote Build Strategy (--remote)
Section titled “Remote Build Strategy (--remote)”- Server Connection: Reads your server config and connects via SSH.
- Environment Prep:
- Checks if the remote directory exists.
- Auto-Upload: If the directory is missing, it automatically tars and uploads your source code to the server.
- Remote Execution:
- It intelligently detects if the remote user has
dockergroup privileges. - If not, it attempts to use
sudofor docker commands. - It runs the appropriate build command (Compose or Standard) on the remote host.
- It intelligently detects if the remote user has
Server Configuration
Section titled “Server Configuration”This command looks for server configurations in this order of priority:
Option A: config/deploy.yml (Recommended)
The primary source of truth for all Wheels Docker operations.
name: myappimage: myuser/myappservers: - host: 192.168.1.100 user: ubuntu role: productionOption B: deploy-servers.json (Legacy)
{ "servers": [ { "host": "192.168.1.100", "user": "ubuntu", "port": 22, "remoteDir": "/var/www/myapp", "imageName": "custom-image-name" } ]}Option C: deploy-servers.txt (Legacy)
Space-separated columns: Host, User, Port (optional).
# Host User Port192.168.1.100 ubuntu 22prod-1.example.com deploy 2202prod-2.example.com deploy 2202