diff --git a/website/docs/9-cli-reference/uc_build.md b/website/docs/9-cli-reference/uc_build.md index 108637e6..0f14f320 100644 --- a/website/docs/9-cli-reference/uc_build.md +++ b/website/docs/9-cli-reference/uc_build.md @@ -2,18 +2,57 @@ Build services from a Compose file. +## Synopsis + +Build images for services from a Compose file using local Docker. + +By default, built images remain on the local Docker host. Use --push to upload them +to cluster machines or --push-registry to upload them to external registries. + ``` uc build [FLAGS] [SERVICE...] [flags] ``` +## Examples + +``` + # Build all services that have a build section in compose.yaml. + uc build + + # Build specific services that have a build section. + uc build web api + + # Build services and push images to all cluster machines or service x-machines if specified. + uc build --push + + # Build services and push images to specific machines. + uc build --push -m machine1,machine2 + + # Build services and push images to external registries (e.g., Docker Hub). + uc build --push-registry + + # Build services with build arguments, pull newer base images before building, and don't use cache. + uc build --build-arg NODE_VERSION=24 --build-arg ENV=production --no-cache --pull +``` + ## Options ``` - -f, --file strings One or more Compose files to build (default compose.yaml) - -h, --help help for build - -n, --no-cache Do not use cache when building images. (default false) - -p, --profile strings One or more Compose profiles to enable. - -P, --push Push built images to the registry after building. (default false) + --build-arg stringArray Set a build-time variable for services. Used in Dockerfiles that declare the variable with ARG. + Can be specified multiple times. Format: --build-arg VAR=VALUE + --check Check the build configuration for services without building them. + -c, --context string Name of the cluster context. (default is the current context) + --deps Also build services declared as dependencies of the selected services. + -f, --file strings One or more Compose files to build. (default compose.yaml) + -h, --help help for build + -m, --machine strings Machine names or IDs to push the built images to (requires --push). + Can be specified multiple times or as a comma-separated list. (default is all machines or x-machines) + --no-cache Do not use cache when building images. + -p, --profile strings One or more Compose profiles to enable. + --pull Always attempt to pull newer versions of base images before building. + --push Upload the built images to cluster machines after building. + Use --machine to specify which machines. (default is all machines) + --push-registry Upload the built images to external registries (e.g., Docker Hub) after building. ``` ## Options inherited from parent commands diff --git a/website/docs/9-cli-reference/uc_caddy_deploy.md b/website/docs/9-cli-reference/uc_caddy_deploy.md index f6c15bc3..fa1205ff 100644 --- a/website/docs/9-cli-reference/uc_caddy_deploy.md +++ b/website/docs/9-cli-reference/uc_caddy_deploy.md @@ -18,7 +18,7 @@ uc caddy deploy [flags] -c, --context string Name of the cluster context to deploy to. (default is the current context) -h, --help help for deploy --image string Caddy Docker image to deploy. (default caddy:LATEST_VERSION) - -m, --machine strings Machine names to deploy to. Can be specified multiple times or as a comma-separated list of machine names. (default is all machines) + -m, --machine strings Machine names or IDs to deploy to. Can be specified multiple times or as a comma-separated list. (default is all machines) ``` ## Options inherited from parent commands diff --git a/website/docs/9-cli-reference/uc_deploy.md b/website/docs/9-cli-reference/uc_deploy.md index f8c42b4b..c8af2361 100644 --- a/website/docs/9-cli-reference/uc_deploy.md +++ b/website/docs/9-cli-reference/uc_deploy.md @@ -9,14 +9,18 @@ uc deploy [FLAGS] [SERVICE...] [flags] ## Options ``` - -c, --context string Name of the cluster context to deploy to (default is the current context) - -f, --file strings One or more Compose files to deploy services from. (default compose.yaml) - -h, --help help for deploy - -n, --no-build Do not build images before deploying services. (default false) - -p, --profile strings One or more Compose profiles to enable. - --recreate Recreate containers even if their configuration and image haven't changed. - -y, --yes Auto-confirm deployment plan. Should be explicitly set when running non-interactively, - e.g., in CI/CD pipelines. [$UNCLOUD_AUTO_CONFIRM] + --build-arg stringArray Set a build-time variable for services. Used in Dockerfiles that declare the variable with ARG. + Can be specified multiple times. Format: --build-arg VAR=VALUE + --build-pull Always attempt to pull newer versions of base images before building service images. + -c, --context string Name of the cluster context to deploy to (default is the current context) + -f, --file strings One or more Compose files to deploy services from. (default compose.yaml) + -h, --help help for deploy + --no-build Do not build new images before deploying services. + --no-cache Do not use cache when building images. + -p, --profile strings One or more Compose profiles to enable. + --recreate Recreate containers even if their configuration and image haven't changed. + -y, --yes Auto-confirm deployment plan. Should be explicitly set when running non-interactively, + e.g., in CI/CD pipelines. [$UNCLOUD_AUTO_CONFIRM] ``` ## Options inherited from parent commands diff --git a/website/docs/9-cli-reference/uc_exec.md b/website/docs/9-cli-reference/uc_exec.md index b101d8d2..5c32c35a 100644 --- a/website/docs/9-cli-reference/uc_exec.md +++ b/website/docs/9-cli-reference/uc_exec.md @@ -26,7 +26,7 @@ uc exec [OPTIONS] SERVICE [COMMAND ARGS...] [flags] uc exec --container d792ea7347e5 web-service ls -la # Pipe input to a command inside the service container - cat /var/log/app.log | uc exec -T web-service grep "ERROR" + cat backup.sql | uc exec -T db-service psql -U postgres mydb # Run a task in the background (detached mode) uc exec -d web-service /scripts/cleanup.sh diff --git a/website/docs/9-cli-reference/uc_image_push.md b/website/docs/9-cli-reference/uc_image_push.md index 386a58bc..31768da1 100644 --- a/website/docs/9-cli-reference/uc_image_push.md +++ b/website/docs/9-cli-reference/uc_image_push.md @@ -35,8 +35,7 @@ uc image push IMAGE [flags] ``` -c, --context string Name of the cluster context. (default is the current context) -h, --help help for push - -m, --machine strings Machine names to push the image to. Can be specified multiple times or as a comma-separated list of machine names. - Use 'all' to push to all machines. (default is connected machine) + -m, --machine strings Machine names or IDs to push the image to. Can be specified multiple times or as a comma-separated list. (default is all machines) --platform string Push a specific platform of a multi-platform image (e.g., linux/amd64, linux/arm64). Local Docker must be configured to use containerd image store to support multi-platform images. ``` diff --git a/website/docs/9-cli-reference/uc_service_exec.md b/website/docs/9-cli-reference/uc_service_exec.md index b48bb4c2..a77ed989 100644 --- a/website/docs/9-cli-reference/uc_service_exec.md +++ b/website/docs/9-cli-reference/uc_service_exec.md @@ -26,7 +26,7 @@ uc service exec [OPTIONS] SERVICE [COMMAND ARGS...] [flags] uc exec --container d792ea7347e5 web-service ls -la # Pipe input to a command inside the service container - cat /var/log/app.log | uc exec -T web-service grep "ERROR" + cat backup.sql | uc exec -T db-service psql -U postgres mydb # Run a task in the background (detached mode) uc exec -d web-service /scripts/cleanup.sh