|
| 1 | +# build-container-image plugin |
| 2 | + |
| 3 | +Wrap a binary in a container image and publish it. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +`build-container-image` is a Swift Package Manager [command plugin](https://github.com/swiftlang/swift-package-manager/blob/main/Documentation/Plugins.md#using-a-package-plugin) which packages a product defined in `Package.swift` in a container image and publishes it to repository on a container registry. |
| 8 | + |
| 9 | +### Usage |
| 10 | + |
| 11 | +`swift package build-container-image [<options>] --repository <repository>` |
| 12 | + |
| 13 | +### Options |
| 14 | + |
| 15 | +- term `--product <product>`: |
| 16 | + The name of the product to package. |
| 17 | + |
| 18 | + If `Package.swift` defines only one product, it will be selected by default. |
| 19 | + |
| 20 | +- term `--default-registry <default-registry>`: |
| 21 | + The default registry hostname. (default: `docker.io`) |
| 22 | + |
| 23 | + If the value of the `--repository` argument does not contain a registry hostname, the default registry will be prepended to the repository path. |
| 24 | + |
| 25 | +- term `--repository <repository>`: |
| 26 | + The repository path. |
| 27 | + |
| 28 | + If the path does not begin with a registry hostname, the default registry will be prepended to the path. |
| 29 | + |
| 30 | +- term `--resources <resources>`: |
| 31 | + Add the file or directory at `resources` to the image. |
| 32 | + Directories are added recursively. |
| 33 | + |
| 34 | + If the `product` being packaged has a [resource bundle](https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package) it will be added to the image automatically. |
| 35 | + |
| 36 | +- term `--username <username>`: |
| 37 | + Username to use when logging into the registry. |
| 38 | + |
| 39 | + The same username is used for the source and destination registries. |
| 40 | + The `.netrc` file is ignored when this option is specified. |
| 41 | + |
| 42 | +- term `--password <password>`: |
| 43 | + Password to use when logging into the registry. |
| 44 | + |
| 45 | + The same password is used for the source and destination registries. |
| 46 | + The `.netrc` file is ignored when this option is specified. |
| 47 | + |
| 48 | +- term `-v, --verbose`: |
| 49 | + Verbose output. |
| 50 | + |
| 51 | +- term `--allow-insecure-http <allow-insecure-http>`: |
| 52 | + Connect to the container registry using plaintext HTTP. (values: `source`, `destination`, `both`) |
| 53 | + |
| 54 | +- term `--architecture <architecture>`: |
| 55 | + CPU architecture to record in the image. |
| 56 | + |
| 57 | +- term `--from <from>`: |
| 58 | + Base image reference. (default: `swift:slim`) |
| 59 | + |
| 60 | + If the base image is `scratch`, the final image will have no base layer and will consist only of the application layer and resource bundle layer, if the product has a resource bundle. |
| 61 | + |
| 62 | +- term `--os <os>`: |
| 63 | + Operating system to record in the image. (default: `linux`) |
| 64 | + |
| 65 | +- term `--tag <tag>`: |
| 66 | + Tag for this manifest. |
| 67 | + |
| 68 | + The `latest` tag is automatically updated to refer to the published image. |
| 69 | + |
| 70 | +- term `--enable-netrc/--disable-netrc`: |
| 71 | + Load credentials from a netrc file (default: `--enable-netrc`) |
| 72 | + |
| 73 | +- term `--netrc-file <netrc-file>`: |
| 74 | + The path to the `.netrc` file. |
| 75 | + |
| 76 | +- term `-h, --help`: |
| 77 | + Show help information. |
| 78 | + |
| 79 | +### Environment |
| 80 | + |
| 81 | +- term `CONTAINERTOOL_DEFAULT_REGISTRY`: |
| 82 | + Default image registry hostname, used when the `--repository` argument does not contain a registry hostname. |
| 83 | + (default: `docker.io`) |
| 84 | + |
| 85 | +- term `CONTAINERTOOL_BASE_IMAGE`: |
| 86 | + Base image on which to layer the application. |
| 87 | + (default: `swift:slim`) |
| 88 | + |
| 89 | +- term `CONTAINERTOOL_OS`: |
| 90 | + Operating system to encode in the container image. |
| 91 | + (default: `Linux`) |
0 commit comments