Author: Robert Kaussow <mail@thegeeklab.de>
Date:   Thu Jun 2 21:48:53 2022 +0200

    docs: refactor plugin properties
This commit is contained in:
Robert Kaussow 2022-06-02 19:52:03 +00:00
parent a62aaa35ca
commit 885a095a9a
3 changed files with 295 additions and 174 deletions

174
_index.md
View File

@ -1,174 +0,0 @@
---
title: drone-docker-buildx
---
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker-buildx?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker-buildx)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-docker-buildx)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-docker-buildx)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker-buildx)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE)
Drone plugin to build and publish multiarch Docker images with buildx.
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Versioning
The tags follow the major version of Docker, e.g. `20`, the minor and patch part reflects the "version" of the plugin. A full example would be `20.12.5`. Minor versions may introduce breaking changes, while patch versions may be considered non-breaking.
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
make build
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
```
## Usage
{{< hint type=important >}}
Be aware that the this plugin requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
{{< /hint >}}
```Shell
docker run --rm \
-e PLUGIN_TAG=latest \
-e PLUGIN_REPO=octocat/hello-world \
-e DRONE_COMMIT_SHA=00000000 \
-v $(pwd):$(pwd) \
-w $(pwd) \
--privileged \
thegeeklab/drone-docker-buildx --dry-run
```
### Parameters
dry_run
: disables docker push
drone_remote_url
: sets the git remote url
mirror
: sets a registry mirror to pull images
storage_driver
: sets the docker daemon storage driver
storage_path
: sets the docker daemon storage path (default `/var/lib/docker`)
bip
: allows the docker daemon to bride ip address
mtu
: sets docker daemon custom mtu setting
custom_dns
: sets custom docker daemon dns server
custom_dns_search
: sets custom docker daemon dns search domain
insecure
: allows the docker daemon to use insecure registries
ipv6
: enables docker daemon ipv6 support
experimental
: enables docker daemon experimental mode
debug
: enables verbose debug mode for the docker daemon
daemon_off
: disables the startup of the docker daemon
buildkit_config
: sets content of the docker buildkit json config
dockerfile
: sets dockerfile to use for the image build (default `./Dockerfile`)
context
: sets the path of the build context to use (default `./`)
tags
: sets repository tags to use for the image; tags can also be loaded from a `.tags` file (default `latest`)
auto_tag
: generates tag names automatically based on git branch and git tag
auto_tag_suffix
: generates tag names with the given suffix
build_args
: sets custom build arguments for the build
build_args_from_env
: forwards environment variables as custom arguments to the build
quiet
: enables suppression of the build output
target
: sets the build target to use
cache_from
: sets images to consider as cache sources
pull_image
: enforces to pull base image at build time (default `true`)
compress
: enables compression of the build context using gzip
output
: sets the [export action](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) for the build result (format: `path` or `type=TYPE[,KEY=VALUE]`)
repo
: sets repository name for the image
registry
: sets docker registry to authenticate with (default `https://index.docker.io/v1/`)
username
: sets username to authenticates with
password
: sets password to authenticates with
email
: sets email address to authenticates with
config
: sets content of the docker daemon json config
purge
: enables cleanup of the docker environment at the end of a build (default `true`)
no_cache
: disables the usage of cached intermediate containers
add_host
: sets additional host:ip mapping
platforms
: sets target platform for build

83
content/_index.md Normal file
View File

@ -0,0 +1,83 @@
---
title: drone-docker-buildx
---
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-docker-buildx?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-docker-buildx)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-docker-buildx)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-docker-buildx)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker-buildx)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-docker-buildx)](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE)
Drone plugin to build and publish multiarch Docker images with buildx.
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Versioning
The tags follow the major version of Docker, e.g. `20`, the minor and patch part reflects the "version" of the plugin. A full example would be `20.12.5`. Minor versions may introduce breaking changes, while patch versions may be considered non-breaking.
## Usage
{{< hint type=important >}}
Be aware that the this plugin requires [privileged](https://docs.drone.io/pipeline/docker/syntax/steps/#privileged-mode) capabilities, otherwise the integrated Docker daemon is not able to start.
{{< /hint >}}
```YAML
kind: pipeline
name: default
steps:
- name: docker
image: thegeeklab/drone-docker-buildx
privileged: true
settings:
username: octocat
password: secure
repo: octocat/example
tags: latest
```
### Parameters
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< propertylist name=drone-docker-buildx.data >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
make build
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
```
## Test
```Shell
docker run --rm \
-e PLUGIN_TAG=latest \
-e PLUGIN_REPO=octocat/hello-world \
-e DRONE_COMMIT_SHA=00000000 \
-v $(pwd):$(pwd) \
-w $(pwd) \
--privileged \
thegeeklab/drone-docker-buildx --dry-run
```

212
data/data.yaml Normal file
View File

@ -0,0 +1,212 @@
---
properties:
dry_run:
description: Disable docker push.
type: bool
required: false
mirror:
description: Use a registry mirror to pull images.
type: string
required: false
storage_driver:
description: The docker daemon storage driver.
type: string
required: false
storage_path:
description: The docker daemon storage path.
defaultValue: /var/lib/docker
type: string
required: false
bip:
description: Allows the docker daemon to bride IP address.
type: string
required: false
mtu:
description: A docker daemon custom MTU.
type: string
required: false
custom_dns:
description: Custom docker daemon DNS server.
type: list
required: false
custom_dns_search:
description: Custom docker daemon DNS search domain.
type: list
required: false
insecure:
description: Enable the usage of insecure registries.
type: bool
defaultValue: false
required: false
ipv6:
description: Enable docker daemon IPv6 support.
type: bool
defaultValue: false
required: false
experimental:
description: Enable docker daemon experimental mode.
type: bool
defaultValue: false
required: false
debug:
description: Enable verbose debug mode for the docker daemon.
type: string
defaultValue: false
required: false
daemon_off:
description: Disable the startup of the docker daemon.
type: string
defaultValue: false
required: false
buildkit_config:
description: Content of the docker buildkit json config.
type: string
defaultValue: false
required: false
dockerfile:
description: Set dockerfile to use for the image build.
defaultValue: Dockerfile
type: string
required: false
context:
description: Set the path of the build context to use.
defaultValue: .
type: string
required: false
tags:
description: Set repository tags to use for the image. Tags can also be loaded from a `.tags` file.
defaultValue: latest
type: list
required: false
auto_tag:
description: |
Generate tag names automatically based on git branch and git tag. When this feature is enabled and the event type is `tag`,
the plugin will automatically tag the image using the standard semVer convention. For example:
- `1.0.0` produces docker tags `1`, `1.0`, `1.0.0`
- `1.0.0-rc.1` produces docker tags `1.0.0-rc.1`
When the event type is `push` and the target branch is your default branch, the plugin will automatically tag the image
as `latest`. All other event types and branches are ignored.
defaultValue: false
type: bool
required: false
auto_tag_suffix:
description: Generate tag names with the given suffix.
type: string
required: false
build_args:
description: Ccustom build arguments to pass to the build.
type: list
required: false
build_args_from_env:
description: Forward environment variables as custom arguments to the build.
type: list
required: false
quiet:
description: Enable suppression of the build output.
defaultValue: false
type: bool
required: false
target:
description: The docker build target.
type: string
required: false
cache_from:
description: Images to consider as cache sources.
type: list
required: false
pull_image:
description: Enforce to pull the base image at build time.
defaultValue: true
type: bool
required: false
compress:
description: Enable compression of the build context using gzip.
defaultValue: false
type: bool
required: false
output:
description: |
[Export action](https://docs.docker.com/engine/reference/commandline/buildx_build/#output) for the build result
(format: `path` or `type=TYPE[,KEY=VALUE]`).
defaultValue: false
type: bool
required: false
repo:
description: Repository name for the image.
type: string
required: false
registry:
description: Docker registry to upload images.
defaultValue: https://index.docker.io/v1/
type: string
required: false
username:
description: Username for authentication with the registry.
type: string
required: false
password:
description: Password for authentication with the registry.
type: string
required: false
email:
description: E-Mail address for authentication with the registry.
type: string
required: false
config:
description: Content of the docker daemon json config.
type: string
required: false
purge:
description: Enable cleanup of the docker environment at the end of a build.
defaultValue: true
type: bool
required: false
no_cache:
description: Disable the usage of cached intermediate containers.
defaultValue: false
type: string
required: false
add_host:
description: Additional `host:ip` mapping.
type: list
required: false
platforms:
description: Target platforms for build.
type: list
required: false