uci-docker-build/lib/src/usage

34 lines
2.4 KiB
Bash

#!/bin/bash
usage() { # Function: Print a help message.
echo "Image Build Script: Creates one or more images using a target in the docker-bake.hcl file"
echo "USAGE: $0 <subcommand> <options> <build_target> <imagename, imageuser>"
echo "valid build_target: ${targets[*]}; default: dev"
echo "### subcommands:"
echo "try (runs try a container script, see try usage) $0 try -i"
echo "tag (runs image_tag script)"
echo "info get image info, info <arch, exists, id> nothing is all info in json"
echo "--- option switches (no argument):"
echo "-o do not overwrite an existing image (default), instead move it to a temporary timestamp tag"
echo "-i rebuild only the initialization RUN by busting the cache at that point"
echo "-v show verbose information about the build"
echo "-a (auto) do not prompt to continue build, by default will not prompt if non-interactive shell"
echo "-c after build try out the image by starting a container terminal therein, for dev target this is the default;"
echo "-x exclude distro from image name;"
echo "-n for --no_cache"
echo "-k keep the build scripts (see -w) after the build so they are incorporated into the image"
echo "-p push to repository; after build push to repository default is hub.docker.com (not need for deploy target)"
echo "--- options with argument <ARGUMENT>:"
echo "-e <path to environment file> load any or all of options below via a file"
echo "-d <LINUX_DISTRO> supported: alpine, debian, ubuntu, default: alpine; if base image set distro will be determined"
echo "-t <TAG> tag following : in output image name (i.e. REPO/USER/NAME:TAG), default: latest"
echo "-u <USER>; repository user prefix in output image name (i.e. REPO/USER/NAME:TAG)"
echo "-r <REPO>; private repo name, do not use for hub.docker.com (docker.io)"
echo "-b <BASE_IMAGE>; used in FROM in Dockerfile, default is official distro image (e.g. alpine:latest)"
echo "-w <BUILD_DIR>; set a custom WORKDIR in Dockerfile (in image), default is /build, see -k"
echo "--- options set ONLY by environment variable (see -e as well)"
echo "<SYSADMIN_PW> set alternate password for container sysadmin account, default is 'sysadmin'"
echo "NOTE any option with <CAPTIALIZED> above can be set in environment instead"
echo "#### examples:"
echo "$0 -a -d ubuntu -u ucommandit"
echo "build (without prompt) a local ubuntu image from scratch and label it ucommandit/ubuntu:latest"
}