Compare commits
3 commits
f61c066940
...
6c8e0f6671
Author | SHA1 | Date | |
---|---|---|---|
Simon Vieille | 6c8e0f6671 | ||
Simon Vieille | 97bb56fa4a | ||
Simon Vieille | 0786fefc51 |
|
@ -12,20 +12,13 @@ variables:
|
|||
platforms: "linux/amd64,linux/arm64"
|
||||
dockerfile: Dockerfile.multiarch
|
||||
auto_tag: true
|
||||
repo: woodpeckerci/plugin-docker-buildx,codeberg.org/woodpecker-plugins/docker-buildx
|
||||
repo: deblan/docker-buildx
|
||||
- &login_setting
|
||||
# Default DockerHub login
|
||||
- registry: https://index.docker.io/v1/
|
||||
- registry: https://gitnet.fr
|
||||
username:
|
||||
from_secret: docker_username
|
||||
from_secret: registry_user
|
||||
password:
|
||||
from_secret: docker_password
|
||||
# Additional Codeberg login
|
||||
- registry: https://codeberg.org
|
||||
username:
|
||||
from_secret: cb_username
|
||||
password:
|
||||
from_secret: cb_password
|
||||
from_secret: registry_password
|
||||
|
||||
steps:
|
||||
vendor:
|
||||
|
@ -73,28 +66,3 @@ steps:
|
|||
when:
|
||||
event: [push, tag, cron]
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
publish_pr_image:
|
||||
image: *build_plugin
|
||||
depends_on: test
|
||||
settings:
|
||||
<<: *base_buildx_settings
|
||||
tag: pull_${CI_COMMIT_PULL_REQUEST}
|
||||
logins: *login_setting
|
||||
when:
|
||||
evaluate: 'CI_COMMIT_PULL_REQUEST_LABELS contains "build_pr_images"'
|
||||
event: pull_request
|
||||
|
||||
# TODO: replace by plugin-ready-release-go once it supports gitea
|
||||
gitea-release:
|
||||
image: "woodpeckerci/plugin-gitea-release:0.3.1"
|
||||
depends_on: test
|
||||
settings:
|
||||
base_url: https://codeberg.org
|
||||
title: ${CI_COMMIT_TAG}
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
target: main
|
||||
when:
|
||||
event: [tag]
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
|
|
@ -183,6 +183,12 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
|||
Usage: "forwards environment variables as custom arguments to the build",
|
||||
Destination: &settings.Build.ArgsEnv,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "mount",
|
||||
EnvVars: []string{"PLUGIN_MOUNT"},
|
||||
Usage: "sets custom mount argument for the build",
|
||||
Destination: &settings.Build.Mount,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "quiet",
|
||||
EnvVars: []string{"PLUGIN_QUIET"},
|
||||
|
|
87
docs.md
87
docs.md
|
@ -92,50 +92,51 @@ docker-build:
|
|||
## Advanced Settings
|
||||
|
||||
|
||||
| Settings Name | Default | Description |
|
||||
| Settings Name | Default | Description |
|
||||
| ------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `mirror` | _none_ | sets a registry mirror to pull images |
|
||||
| `storage_driver` | _none_ | sets the docker daemon storage driver |
|
||||
| `storage_path` | `/var/lib/docker` | sets the docker daemon storage path |
|
||||
| `bip` | _none_ | allows the docker daemon to bride ip address |
|
||||
| `mtu` | _none_ | sets docker daemon custom mtu setting |
|
||||
| `custom_dns` | _none_ | sets custom docker daemon dns server |
|
||||
| `custom_dns_search` | _none_ | sets custom docker daemon dns search domain |
|
||||
| `insecure` | `false` | allows the docker daemon to use insecure registries |
|
||||
| `ipv6` | `false` | enables docker daemon IPv6 support |
|
||||
| `experimental` | `false` | enables docker daemon experimental mode |
|
||||
| `debug` | `false` | enables verbose debug mode for the docker daemon |
|
||||
| `daemon_off` | `false` | disables the startup of the docker daemon |
|
||||
| `buildkit_debug` | `false` | enables debug output of buildkit |
|
||||
| `buildkit_config` | _none_ | sets content of the docker[buildkit TOML config](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) |
|
||||
| `buildkit_driveropt` | _none_ | adds one or multiple`--driver-opt` buildx arguments for the default buildkit builder instance |
|
||||
| `tags_file` | _none_ | overrides the`tags` option with values in a file named `.tags`; multiple tags can be specified separated by a newline |
|
||||
| `context` | `.` | sets the path of the build context to use |
|
||||
| `auto_tag` | `false` | generates tag names automatically based on git branch and git tag, tags supplied via`tags` are additionally added to the auto_tags without suffix |
|
||||
| `default_suffix"`/`auto_tag_suffix` | _none_ | generates tag names with the given suffix |
|
||||
| `default_tag` | `latest` | overrides the default tag name used when generating with`auto_tag` enabled |
|
||||
| `label`/`labels` | _none_ | sets labels to use for the image in format`<name>=<value>` |
|
||||
| `default_labels`/`auto_labels` | `true` | sets docker image labels based on git information |
|
||||
| `build_args` | _none_ | sets custom build arguments for the build |
|
||||
| `build_args_from_env` | _none_ | forwards environment variables as custom arguments to the build |
|
||||
| `quiet` | `false` | enables suppression of the build output |
|
||||
| `target` | _none_ | sets the build target to use |
|
||||
| `cache_from` | _none_ | sets configuration for cache source |
|
||||
| `cache_to` | _none_ | sets configuration for cache export |
|
||||
| `cache_images` | _none_ | a list of images to use as cache. |
|
||||
| `pull_image` | `true` | enforces to pull base image at build time |
|
||||
| `compress` | `false` | enables compression of the build context using gzip |
|
||||
| `config` | _none_ | sets content of the docker daemon json config |
|
||||
| `purge` | `true` | enables cleanup of the docker environment at the end of a build |
|
||||
| `no_cache` | `false` | disables the usage of cached intermediate containers |
|
||||
| `add_host` | _none_ | sets additional host:ip mapping |
|
||||
| `output` | _none_ | sets build output in format`type=<type>[,<key>=<value>]` |
|
||||
| `logins` | _none_ | option to log into multiple registries |
|
||||
| `env_file` | _none_ | load env vars from specified file |
|
||||
| `ecr_create_repository` | `false` | creates the ECR repository if it does not exist |
|
||||
| `ecr_lifecycle_policy` | _none_ | AWS ECR lifecycle policy |
|
||||
| `ecr_repository_policy` | _none_ | AWS ECR repository policy |
|
||||
| `ecr_scan_on_push` | _none_ | AWS: whether to enable image scanning on push |
|
||||
| `mirror` | _none_ | sets a registry mirror to pull images |
|
||||
| `storage_driver` | _none_ | sets the docker daemon storage driver |
|
||||
| `storage_path` | `/var/lib/docker` | sets the docker daemon storage path |
|
||||
| `bip` | _none_ | allows the docker daemon to bride ip address |
|
||||
| `mtu` | _none_ | sets docker daemon custom mtu setting |
|
||||
| `custom_dns` | _none_ | sets custom docker daemon dns server |
|
||||
| `custom_dns_search` | _none_ | sets custom docker daemon dns search domain |
|
||||
| `insecure` | `false` | allows the docker daemon to use insecure registries |
|
||||
| `ipv6` | `false` | enables docker daemon IPv6 support |
|
||||
| `experimental` | `false` | enables docker daemon experimental mode |
|
||||
| `debug` | `false` | enables verbose debug mode for the docker daemon |
|
||||
| `daemon_off` | `false` | disables the startup of the docker daemon |
|
||||
| `buildkit_debug` | `false` | enables debug output of buildkit |
|
||||
| `buildkit_config` | _none_ | sets content of the docker[buildkit TOML config](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md) |
|
||||
| `buildkit_driveropt` | _none_ | adds one or multiple`--driver-opt` buildx arguments for the default buildkit builder instance |
|
||||
| `tags_file` | _none_ | overrides the`tags` option with values in a file named `.tags`; multiple tags can be specified separated by a newline |
|
||||
| `context` | `.` | sets the path of the build context to use |
|
||||
| `auto_tag` | `false` | generates tag names automatically based on git branch and git tag, tags supplied via`tags` are additionally added to the auto_tags without suffix |
|
||||
| `default_suffix"`/`auto_tag_suffix` | _none_ | generates tag names with the given suffix |
|
||||
| `default_tag` | `latest` | overrides the default tag name used when generating with`auto_tag` enabled |
|
||||
| `label`/`labels` | _none_ | sets labels to use for the image in format`<name>=<value>` |
|
||||
| `default_labels`/`auto_labels` | `true` | sets docker image labels based on git information |
|
||||
| `build_args` | _none_ | sets custom build arguments for the build |
|
||||
| `build_args_from_env` | _none_ | forwards environment variables as custom arguments to the build |
|
||||
| `mount` | _none_ | Sets the build mount to user |
|
||||
| `quiet` | `false` | enables suppression of the build output |
|
||||
| `target` | _none_ | sets the build target to use |
|
||||
| `cache_from` | _none_ | sets configuration for cache source |
|
||||
| `cache_to` | _none_ | sets configuration for cache export |
|
||||
| `cache_images` | _none_ | a list of images to use as cache. |
|
||||
| `pull_image` | `true` | enforces to pull base image at build time |
|
||||
| `compress` | `false` | enables compression of the build context using gzip |
|
||||
| `config` | _none_ | sets content of the docker daemon json config |
|
||||
| `purge` | `true` | enables cleanup of the docker environment at the end of a build |
|
||||
| `no_cache` | `false` | disables the usage of cached intermediate containers |
|
||||
| `add_host` | _none_ | sets additional host:ip mapping |
|
||||
| `output` | _none_ | sets build output in format`type=<type>[,<key>=<value>]` |
|
||||
| `logins` | _none_ | option to log into multiple registries |
|
||||
| `env_file` | _none_ | load env vars from specified file |
|
||||
| `ecr_create_repository` | `false` | creates the ECR repository if it does not exist |
|
||||
| `ecr_lifecycle_policy` | _none_ | AWS ECR lifecycle policy |
|
||||
| `ecr_repository_policy` | _none_ | AWS ECR repository policy |
|
||||
| `ecr_scan_on_push` | _none_ | AWS: whether to enable image scanning on push |
|
||||
|
||||
## Multi registry push example
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ func commandBuild(build Build, dryrun bool) *exec.Cmd {
|
|||
for _, arg := range append(defaultBuildArgs, build.Args.Value()...) {
|
||||
args = append(args, "--build-arg", arg)
|
||||
}
|
||||
if build.Mount != "" {
|
||||
args = append(args, "--mount", build.Mount)
|
||||
}
|
||||
for _, host := range build.AddHost.Value() {
|
||||
args = append(args, "--add-host", host)
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ type Build struct {
|
|||
Platforms cli.StringSlice // Docker build target platforms
|
||||
Args cli.StringSlice // Docker build args
|
||||
ArgsEnv cli.StringSlice // Docker build args from env
|
||||
Mount string // Docker build mount
|
||||
Target string // Docker build target
|
||||
Output string // Docker build output
|
||||
Pull bool // Docker build pull
|
||||
|
|
Loading…
Reference in a new issue