#!/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 " 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 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 :" echo "-e load any or all of options below via a file" echo "-d supported: alpine, debian, ubuntu, default: alpine; if base image set distro will be determined" echo "-t tag following : in output image name (i.e. REPO/USER/NAME:TAG), default: latest" echo "-u ; repository user prefix in output image name (i.e. REPO/USER/NAME:TAG)" echo "-r ; private repo name, do not use for hub.docker.com (docker.io)" echo "-b ; used in FROM in Dockerfile, default is official distro image (e.g. alpine:latest)" echo "-w ; 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 " set alternate password for container sysadmin account, default is 'sysadmin'" echo "NOTE any option with 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" }