0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-21 13:50:39 +00:00

docs: add parameter documentation (#53)

This commit is contained in:
Robert Kaussow 2021-09-11 21:15:02 +02:00 committed by GitHub
parent 276f215b24
commit 2404bc12a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 468 additions and 246 deletions

17
.dictionary Normal file
View File

@ -0,0 +1,17 @@
url
ip
mtu
dns
ipv6
buildkit
json
config
dockerfile
og
gzip
json
config
host:ip
drone-docker-buildx
multiarch
buildx

View File

@ -235,6 +235,60 @@ local PipelineBuildContainer(arch='amd64') = {
}, },
}; };
local PipelineDocs = {
kind: 'pipeline',
name: 'docs',
platform: {
os: 'linux',
arch: 'amd64',
},
concurrency: {
limit: 1,
},
steps: [
{
name: 'markdownlint',
image: 'thegeeklab/markdownlint-cli',
commands: [
"markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'",
],
},
{
name: 'spellcheck',
image: 'node:lts-alpine',
commands: [
'npm install -g spellchecker-cli',
"spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
],
environment: {
FORCE_COLOR: true,
NPM_CONFIG_LOGLEVEL: 'error',
},
},
{
name: 'publish',
image: 'plugins/gh-pages',
settings: {
username: { from_secret: 'github_username' },
password: { from_secret: 'github_token' },
pages_directory: '_docs/',
target_branch: 'docs',
},
when: {
ref: ['refs/heads/main'],
},
},
],
depends_on: [
'build-binaries',
'build-container-amd64',
'build-container-arm64',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = { local PipelineNotifications = {
kind: 'pipeline', kind: 'pipeline',
image_pull_secrets: ['docker_config'], image_pull_secrets: ['docker_config'],
@ -320,9 +374,7 @@ local PipelineNotifications = {
}, },
], ],
depends_on: [ depends_on: [
'build-binaries', 'docs',
'build-container-amd64',
'build-container-arm64',
], ],
trigger: { trigger: {
ref: ['refs/heads/main', 'refs/tags/**'], ref: ['refs/heads/main', 'refs/tags/**'],
@ -335,5 +387,6 @@ local PipelineNotifications = {
PipelineBuildBinaries, PipelineBuildBinaries,
PipelineBuildContainer(arch='amd64'), PipelineBuildContainer(arch='amd64'),
PipelineBuildContainer(arch='arm64'), PipelineBuildContainer(arch='arm64'),
PipelineDocs,
PipelineNotifications, PipelineNotifications,
] ]

View File

@ -1,106 +1,96 @@
--- ---
kind: pipeline
name: test
platform:
os: linux
arch: amd64
steps:
- name: staticcheck
image: golang:1.16
commands:
- go run honnef.co/go/tools/cmd/staticcheck ./...
volumes:
- name: gopath
path: /go
- name: lint
image: golang:1.16
commands:
- go run golang.org/x/lint/golint -set_exit_status ./...
volumes:
- name: gopath
path: /go
- name: vet
image: golang:1.16
commands:
- go vet ./...
volumes:
- name: gopath
path: /go
- name: test
image: golang:1.16
commands:
- go test -cover ./...
volumes:
- name: gopath
path: /go
volumes:
- name: gopath
temp: {}
image_pull_secrets: image_pull_secrets:
- docker_config - docker_config
kind: pipeline
name: test
platform:
arch: amd64
os: linux
steps:
- commands:
- go run honnef.co/go/tools/cmd/staticcheck ./...
image: golang:1.16
name: staticcheck
volumes:
- name: gopath
path: /go
- commands:
- go run golang.org/x/lint/golint -set_exit_status ./...
image: golang:1.16
name: lint
volumes:
- name: gopath
path: /go
- commands:
- go vet ./...
image: golang:1.16
name: vet
volumes:
- name: gopath
path: /go
- commands:
- go test -cover ./...
image: golang:1.16
name: test
volumes:
- name: gopath
path: /go
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
volumes:
- name: gopath
temp: {}
--- ---
depends_on:
- test
image_pull_secrets:
- docker_config
kind: pipeline kind: pipeline
name: build-binaries name: build-binaries
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: build - commands:
image: techknowlogick/xgo:go-1.16.x - '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
commands:
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}"
- mkdir -p release/ - mkdir -p release/
- cd cmd/drone-docker-buildx && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-docker-buildx . - cd cmd/drone-docker-buildx && xgo -ldflags "-s -w -X main.version=$BUILD_VERSION"
-tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm-7,linux/arm64' -out drone-docker-buildx
.
- mv /build/* /drone/src/release/ - mv /build/* /drone/src/release/
- ls -l /drone/src/release/ - ls -l /drone/src/release/
image: techknowlogick/xgo:go-1.16.x
- name: executable name: build
image: alpine - commands:
commands:
- $(find release/ -executable -type f | grep drone-docker-buildx-linux-amd64) --help - $(find release/ -executable -type f | grep drone-docker-buildx-linux-amd64) --help
- name: compress
image: alpine image: alpine
commands: name: executable
- commands:
- apk add upx - apk add upx
- find release/ -maxdepth 1 -executable -type f -exec upx {} \; - find release/ -maxdepth 1 -executable -type f -exec upx {} \;
- ls -lh release/ - ls -lh release/
- name: checksum
image: alpine image: alpine
commands: name: compress
- commands:
- cd release/ && sha256sum * > sha256sum.txt - cd release/ && sha256sum * > sha256sum.txt
image: alpine
- name: changelog-generate name: checksum
image: thegeeklab/git-chglog - commands:
commands:
- git fetch -tq - git fetch -tq
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased} - git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
unreleased}
- name: changelog-format image: thegeeklab/git-chglog
image: thegeeklab/alpine-tools name: changelog-generate
commands: - commands:
- prettier CHANGELOG.md - prettier CHANGELOG.md
- prettier -w CHANGELOG.md - prettier -w CHANGELOG.md
image: thegeeklab/alpine-tools
- name: publish name: changelog-format
image: plugins/github-release - image: plugins/github-release
name: publish
settings: settings:
api_key: api_key:
from_secret: github_token from_secret: github_token
@ -112,36 +102,32 @@ steps:
when: when:
ref: ref:
- refs/tags/** - refs/tags/**
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- test - test
image_pull_secrets:
--- - docker_config
kind: pipeline kind: pipeline
name: build-container-amd64 name: build-container-amd64
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: build - commands:
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/amd64/drone-docker-buildx
./cmd/drone-docker-buildx
image: golang:1.16 image: golang:1.16
commands: name: build
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - depends_on:
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/amd64/drone-docker-buildx ./cmd/drone-docker-buildx - build
- name: dryrun
image: plugins/docker:19 image: plugins/docker:19
name: dryrun
settings: settings:
config: config:
from_secret: docker_config from_secret: docker_config
@ -155,11 +141,10 @@ steps:
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
depends_on: - depends_on:
- build - dryrun
- name: publish-dockerhub
image: plugins/docker:19 image: plugins/docker:19
name: publish-dockerhub
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: amd64 auto_tag_suffix: amd64
@ -175,11 +160,10 @@ steps:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
depends_on: - depends_on:
- dryrun - dryrun
- name: publish-quay
image: plugins/docker:19 image: plugins/docker:19
name: publish-quay
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: amd64 auto_tag_suffix: amd64
@ -196,38 +180,32 @@ steps:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
depends_on:
- dryrun
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
---
depends_on: depends_on:
- test - test
image_pull_secrets:
--- - docker_config
kind: pipeline kind: pipeline
name: build-container-arm64 name: build-container-arm64
platform: platform:
os: linux
arch: arm64 arch: arm64
os: linux
steps: steps:
- name: build - commands:
- '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}'
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm64/drone-docker-buildx
./cmd/drone-docker-buildx
image: golang:1.16 image: golang:1.16
commands: name: build
- "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - depends_on:
- go build -v -ldflags "-X main.version=$BUILD_VERSION" -a -tags netgo -o release/arm64/drone-docker-buildx ./cmd/drone-docker-buildx - build
- name: dryrun
image: plugins/docker:19 image: plugins/docker:19
name: dryrun
settings: settings:
config: config:
from_secret: docker_config from_secret: docker_config
@ -241,11 +219,10 @@ steps:
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
depends_on: - depends_on:
- build - dryrun
- name: publish-dockerhub
image: plugins/docker:19 image: plugins/docker:19
name: publish-dockerhub
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm64 auto_tag_suffix: arm64
@ -261,11 +238,10 @@ steps:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
depends_on: - depends_on:
- dryrun - dryrun
- name: publish-quay
image: plugins/docker:19 image: plugins/docker:19
name: publish-quay
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: arm64 auto_tag_suffix: arm64
@ -282,32 +258,67 @@ steps:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
depends_on:
- dryrun
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- refs/pull/** - refs/pull/**
depends_on:
- test
--- ---
concurrency:
limit: 1
depends_on:
- build-binaries
- build-container-amd64
- build-container-arm64
kind: pipeline
name: docs
platform:
arch: amd64
os: linux
steps:
- commands:
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
image: thegeeklab/markdownlint-cli
name: markdownlint
- commands:
- npm install -g spellchecker-cli
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary
-p spell indefinite-article syntax-urls --no-suggestions
environment:
FORCE_COLOR: true
NPM_CONFIG_LOGLEVEL: error
image: node:lts-alpine
name: spellcheck
- image: plugins/gh-pages
name: publish
settings:
pages_directory: _docs/
password:
from_secret: github_token
target_branch: docs
username:
from_secret: github_username
when:
ref:
- refs/heads/main
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
---
depends_on:
- docs
image_pull_secrets:
- docker_config
kind: pipeline kind: pipeline
name: notifications name: notifications
platform: platform:
os: linux
arch: amd64 arch: amd64
os: linux
steps: steps:
- name: manifest-dockerhub - image: plugins/manifest
image: plugins/manifest name: manifest-dockerhub
settings: settings:
auto_tag: true auto_tag: true
ignore_missing: true ignore_missing: true
@ -319,9 +330,8 @@ steps:
when: when:
status: status:
- success - success
- image: plugins/manifest
- name: manifest-quay name: manifest-quay
image: plugins/manifest
settings: settings:
auto_tag: true auto_tag: true
ignore_missing: true ignore_missing: true
@ -333,10 +343,7 @@ steps:
when: when:
status: status:
- success - success
- environment:
- name: pushrm-dockerhub
image: chko/docker-pushrm:1
environment:
DOCKER_PASS: DOCKER_PASS:
from_secret: docker_password from_secret: docker_password
DOCKER_USER: DOCKER_USER:
@ -344,23 +351,23 @@ steps:
PUSHRM_FILE: README.md PUSHRM_FILE: README.md
PUSHRM_SHORT: Drone plugin to build multiarch Docker images with buildx PUSHRM_SHORT: Drone plugin to build multiarch Docker images with buildx
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME} PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
image: chko/docker-pushrm:1
name: pushrm-dockerhub
when: when:
status: status:
- success - success
- environment:
- name: pushrm-quay
image: chko/docker-pushrm:1
environment:
APIKEY__QUAY_IO: APIKEY__QUAY_IO:
from_secret: quay_token from_secret: quay_token
PUSHRM_FILE: README.md PUSHRM_FILE: README.md
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME} PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
image: chko/docker-pushrm:1
name: pushrm-quay
when: when:
status: status:
- success - success
- image: plugins/matrix
- name: matrix name: matrix
image: plugins/matrix
settings: settings:
homeserver: homeserver:
from_secret: matrix_homeserver from_secret: matrix_homeserver
@ -368,17 +375,15 @@ steps:
from_secret: matrix_password from_secret: matrix_password
roomid: roomid:
from_secret: matrix_roomid from_secret: matrix_roomid
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}" template: 'Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name
}}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message:
{{ build.message }}'
username: username:
from_secret: matrix_username from_secret: matrix_username
when: when:
status: status:
- success - success
- failure - failure
image_pull_secrets:
- docker_config
trigger: trigger:
ref: ref:
- refs/heads/main - refs/heads/main
@ -386,14 +391,8 @@ trigger:
status: status:
- success - success
- failure - failure
depends_on:
- build-binaries
- build-container-amd64
- build-container-arm64
--- ---
kind: signature kind: signature
hmac: d9ed315db5e0514b6151de65d4281802fad0882c5f71feff2f27a5686a794356 hmac: 8dfd1d8d060f0e05affcae91a05e8d6184219c6d5f99747bcd73da0739e82c81
... ...

10
.github/settings.yml vendored
View File

@ -1,6 +1,7 @@
repository: repository:
name: drone-docker-buildx name: drone-docker-buildx
description: Drone plugin to build multiarch Docker images with buildx description: Drone plugin to build multiarch Docker images with buildx
homepage: https://drone-plugin-index.geekdocs.de/plugins/drone-docker-buildx
topics: drone, drone-plugin topics: drone, drone-plugin
private: false private: false
@ -53,3 +54,12 @@ branches:
- continuous-integration/drone/pr - continuous-integration/drone/pr
enforce_admins: null enforce_admins: null
restrictions: null restrictions: null
- name: docs
protection:
required_pull_request_reviews: null
required_status_checks: null
enforce_admins: true
restrictions:
users: []
teams:
- bot

6
.markdownlint.yml Normal file
View File

@ -0,0 +1,6 @@
---
default: True
MD013: False
MD041: False
MD004:
style: dash

View File

@ -10,46 +10,12 @@ Drone plugin to build multiarch Docker images with buildx
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-docker-buildx) [![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) [![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 multiarch Docker images with buildx. This plugin is a fork of [drone-plugins/drone-docker](https://github.com/drone-plugins/drone-docker). Drone plugin to build multiarch Docker images with buildx. This plugin is a fork of [drone-plugins/drone-docker](https://github.com/drone-plugins/drone-docker). You can find the full documentation at You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-docker-buildx).
## Docker Tags ## Versioning
Tags are following the main Docker version e.g. `20.10`, the second part is reflecting the plugin "version". A full example would be `20.10.5`. Tags are following the main Docker version e.g. `20.10`, the second part is reflecting the plugin "version". A full example would be `20.10.5`.
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
go build -v -a -tags netgo -o release/drone-docker-buildx
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
```
## Usage
> Notice: Be aware that the tis plugin requires privileged capabilities, otherwise the integrated Docker daemon is not able to start.
```console
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
```
## Community ## Community
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->

171
_docs/_index.md Normal file
View File

@ -0,0 +1,171 @@
---
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)
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Versioning
Tags are following the main Docker version e.g. `20.10`, the second part is reflecting the plugin "version". A full example would be `20.10.5`.
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
go build -v -a -tags netgo -o release/drone-docker-buildx
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx .
```
## Usage
{{< hint warning >}}
**Note**\
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 og the build context using gzip
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

View File

@ -10,232 +10,232 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
return []cli.Flag{ return []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "dry-run", Name: "dry-run",
Usage: "dry run disables docker push",
EnvVars: []string{"PLUGIN_DRY_RUN"}, EnvVars: []string{"PLUGIN_DRY_RUN"},
Usage: "disables docker push",
Destination: &settings.Dryrun, Destination: &settings.Dryrun,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "remote.url", Name: "remote.url",
Usage: "git remote url",
EnvVars: []string{"DRONE_REMOTE_URL"}, EnvVars: []string{"DRONE_REMOTE_URL"},
Usage: "sets the git remote url",
Destination: &settings.Build.Remote, Destination: &settings.Build.Remote,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.mirror", Name: "daemon.mirror",
Usage: "docker daemon registry mirror",
EnvVars: []string{"PLUGIN_MIRROR", "DOCKER_PLUGIN_MIRROR"}, EnvVars: []string{"PLUGIN_MIRROR", "DOCKER_PLUGIN_MIRROR"},
Usage: "sets a registry mirror to pull images",
Destination: &settings.Daemon.Mirror, Destination: &settings.Daemon.Mirror,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.storage-driver", Name: "daemon.storage-driver",
Usage: "docker daemon storage driver",
EnvVars: []string{"PLUGIN_STORAGE_DRIVER"}, EnvVars: []string{"PLUGIN_STORAGE_DRIVER"},
Usage: "sets the docker daemon storage driver",
Destination: &settings.Daemon.StorageDriver, Destination: &settings.Daemon.StorageDriver,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.storage-path", Name: "daemon.storage-path",
Usage: "docker daemon storage path",
Value: "/var/lib/docker",
EnvVars: []string{"PLUGIN_STORAGE_PATH"}, EnvVars: []string{"PLUGIN_STORAGE_PATH"},
Usage: "sets the docker daemon storage path",
Value: "/var/lib/docker",
Destination: &settings.Daemon.StoragePath, Destination: &settings.Daemon.StoragePath,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.bip", Name: "daemon.bip",
Usage: "docker daemon bride ip address",
EnvVars: []string{"PLUGIN_BIP"}, EnvVars: []string{"PLUGIN_BIP"},
Usage: "allows the docker daemon to bride ip address",
Destination: &settings.Daemon.Bip, Destination: &settings.Daemon.Bip,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.mtu", Name: "daemon.mtu",
Usage: "docker daemon custom mtu setting",
EnvVars: []string{"PLUGIN_MTU"}, EnvVars: []string{"PLUGIN_MTU"},
Usage: "sets docker daemon custom mtu setting",
Destination: &settings.Daemon.MTU, Destination: &settings.Daemon.MTU,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "daemon.dns", Name: "daemon.dns",
Usage: "docker daemon dns server",
EnvVars: []string{"PLUGIN_CUSTOM_DNS"}, EnvVars: []string{"PLUGIN_CUSTOM_DNS"},
Usage: "sets custom docker daemon dns server",
Destination: &settings.Daemon.DNS, Destination: &settings.Daemon.DNS,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "daemon.dns-search", Name: "daemon.dns-search",
Usage: "docker daemon dns search domains",
EnvVars: []string{"PLUGIN_CUSTOM_DNS_SEARCH"}, EnvVars: []string{"PLUGIN_CUSTOM_DNS_SEARCH"},
Usage: "sets custom docker daemon dns search domain",
Destination: &settings.Daemon.DNSSearch, Destination: &settings.Daemon.DNSSearch,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "daemon.insecure", Name: "daemon.insecure",
Usage: "docker daemon allows insecure registries",
EnvVars: []string{"PLUGIN_INSECURE"}, EnvVars: []string{"PLUGIN_INSECURE"},
Usage: "allows the docker daemon to use insecure registries",
Destination: &settings.Daemon.Insecure, Destination: &settings.Daemon.Insecure,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "daemon.ipv6", Name: "daemon.ipv6",
Usage: "docker daemon IPv6 networking",
EnvVars: []string{"PLUGIN_IPV6"}, EnvVars: []string{"PLUGIN_IPV6"},
Usage: "enables docker daemon IPv6 support",
Destination: &settings.Daemon.IPv6, Destination: &settings.Daemon.IPv6,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "daemon.experimental", Name: "daemon.experimental",
Usage: "docker daemon Experimental mode",
EnvVars: []string{"PLUGIN_EXPERIMENTAL"}, EnvVars: []string{"PLUGIN_EXPERIMENTAL"},
Usage: "enables docker daemon experimental mode",
Destination: &settings.Daemon.Experimental, Destination: &settings.Daemon.Experimental,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "daemon.debug", Name: "daemon.debug",
Usage: "docker daemon executes in debug mode",
EnvVars: []string{"PLUGIN_DEBUG", "DOCKER_LAUNCH_DEBUG"}, EnvVars: []string{"PLUGIN_DEBUG", "DOCKER_LAUNCH_DEBUG"},
Usage: "enables verbose debug mode for the docker daemon",
Destination: &settings.Daemon.Debug, Destination: &settings.Daemon.Debug,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "daemon.off", Name: "daemon.off",
Usage: "don't start the docker daemon",
EnvVars: []string{"PLUGIN_DAEMON_OFF"}, EnvVars: []string{"PLUGIN_DAEMON_OFF"},
Usage: "disables the startup of the docker daemon",
Destination: &settings.Daemon.Disabled, Destination: &settings.Daemon.Disabled,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "daemon.buildkit-config", Name: "daemon.buildkit-config",
Usage: "docker buildkit json config content",
EnvVars: []string{"PLUGIN_BUILDKIT_CONFIG"}, EnvVars: []string{"PLUGIN_BUILDKIT_CONFIG"},
Usage: "sets content of the docker buildkit json config",
Destination: &settings.Daemon.BuildkitConfig, Destination: &settings.Daemon.BuildkitConfig,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "dockerfile", Name: "dockerfile",
Usage: "build dockerfile",
Value: "Dockerfile",
EnvVars: []string{"PLUGIN_DOCKERFILE"}, EnvVars: []string{"PLUGIN_DOCKERFILE"},
Usage: "sets dockerfile to use for the image build",
Value: "Dockerfile",
Destination: &settings.Build.Dockerfile, Destination: &settings.Build.Dockerfile,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "context", Name: "context",
Usage: "build context",
Value: ".",
EnvVars: []string{"PLUGIN_CONTEXT"}, EnvVars: []string{"PLUGIN_CONTEXT"},
Usage: "sets the path of the build context to use",
Value: ".",
Destination: &settings.Build.Context, Destination: &settings.Build.Context,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "tags", Name: "tags",
Usage: "build tags",
Value: cli.NewStringSlice([]string{"latest"}...),
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"}, EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
Usage: "sets repository tags to use for the image",
Value: cli.NewStringSlice([]string{"latest"}...),
FilePath: ".tags", FilePath: ".tags",
Destination: &settings.Build.Tags, Destination: &settings.Build.Tags,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "tags.auto", Name: "tags.auto",
Usage: "default build tags",
EnvVars: []string{"PLUGIN_DEFAULT_TAGS", "PLUGIN_AUTO_TAG"}, EnvVars: []string{"PLUGIN_DEFAULT_TAGS", "PLUGIN_AUTO_TAG"},
Usage: "generates tag names automatically based on git branch and git tag",
Destination: &settings.Build.TagsAuto, Destination: &settings.Build.TagsAuto,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "tags.suffix", Name: "tags.suffix",
Usage: "default build tags with suffix",
EnvVars: []string{"PLUGIN_DEFAULT_SUFFIX", "PLUGIN_AUTO_TAG_SUFFIX"}, EnvVars: []string{"PLUGIN_DEFAULT_SUFFIX", "PLUGIN_AUTO_TAG_SUFFIX"},
Usage: "generates tag names with the given suffix",
Destination: &settings.Build.TagsSuffix, Destination: &settings.Build.TagsSuffix,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "args", Name: "args",
Usage: "build args",
EnvVars: []string{"PLUGIN_BUILD_ARGS"}, EnvVars: []string{"PLUGIN_BUILD_ARGS"},
Usage: "sets custom build arguments for the build",
Destination: &settings.Build.Args, Destination: &settings.Build.Args,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "args-from-env", Name: "args-from-env",
Usage: "build args",
EnvVars: []string{"PLUGIN_BUILD_ARGS_FROM_ENV"}, EnvVars: []string{"PLUGIN_BUILD_ARGS_FROM_ENV"},
Usage: "forwards environment variables as custom arguments to the build",
Destination: &settings.Build.ArgsEnv, Destination: &settings.Build.ArgsEnv,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "quiet", Name: "quiet",
Usage: "quiet docker build",
EnvVars: []string{"PLUGIN_QUIET"}, EnvVars: []string{"PLUGIN_QUIET"},
Usage: "enables suppression of the build output",
Destination: &settings.Build.Quiet, Destination: &settings.Build.Quiet,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "target", Name: "target",
Usage: "build target",
EnvVars: []string{"PLUGIN_TARGET"}, EnvVars: []string{"PLUGIN_TARGET"},
Usage: "sets the build target to use",
Destination: &settings.Build.Target, Destination: &settings.Build.Target,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "cache-from", Name: "cache-from",
Usage: "images to consider as cache sources",
EnvVars: []string{"PLUGIN_CACHE_FROM"}, EnvVars: []string{"PLUGIN_CACHE_FROM"},
Usage: "sets images to consider as cache sources",
Destination: &settings.Build.CacheFrom, Destination: &settings.Build.CacheFrom,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "pull-image", Name: "pull-image",
Usage: "force pull base image at build time",
EnvVars: []string{"PLUGIN_PULL_IMAGE"}, EnvVars: []string{"PLUGIN_PULL_IMAGE"},
Usage: "enforces to pull base image at build time",
Value: true, Value: true,
Destination: &settings.Build.Pull, Destination: &settings.Build.Pull,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "compress", Name: "compress",
Usage: "compress the build context using gzip",
EnvVars: []string{"PLUGIN_COMPRESS"}, EnvVars: []string{"PLUGIN_COMPRESS"},
Usage: "enables compression og the build context using gzip",
Destination: &settings.Build.Compress, Destination: &settings.Build.Compress,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "repo", Name: "repo",
Usage: "docker repository",
EnvVars: []string{"PLUGIN_REPO"}, EnvVars: []string{"PLUGIN_REPO"},
Usage: "sets repository name for the image",
Destination: &settings.Build.Repo, Destination: &settings.Build.Repo,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "docker.registry", Name: "docker.registry",
Usage: "docker registry",
Value: "https://index.docker.io/v1/",
EnvVars: []string{"PLUGIN_REGISTRY", "DOCKER_REGISTRY"}, EnvVars: []string{"PLUGIN_REGISTRY", "DOCKER_REGISTRY"},
Usage: "sets docker registry to authenticate with",
Value: "https://index.docker.io/v1/",
Destination: &settings.Login.Registry, Destination: &settings.Login.Registry,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "docker.username", Name: "docker.username",
Usage: "docker username",
EnvVars: []string{"PLUGIN_USERNAME", "DOCKER_USERNAME"}, EnvVars: []string{"PLUGIN_USERNAME", "DOCKER_USERNAME"},
Usage: "sets username to authenticates with",
Destination: &settings.Login.Username, Destination: &settings.Login.Username,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "docker.password", Name: "docker.password",
Usage: "docker password",
EnvVars: []string{"PLUGIN_PASSWORD", "DOCKER_PASSWORD"}, EnvVars: []string{"PLUGIN_PASSWORD", "DOCKER_PASSWORD"},
Usage: "sets password to authenticates with",
Destination: &settings.Login.Password, Destination: &settings.Login.Password,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "docker.email", Name: "docker.email",
Usage: "docker email",
EnvVars: []string{"PLUGIN_EMAIL", "DOCKER_EMAIL"}, EnvVars: []string{"PLUGIN_EMAIL", "DOCKER_EMAIL"},
Usage: "sets email address to authenticates with",
Destination: &settings.Login.Email, Destination: &settings.Login.Email,
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "docker.config", Name: "docker.config",
Usage: "docker json dockerconfig content",
EnvVars: []string{"PLUGIN_CONFIG", "DOCKER_PLUGIN_CONFIG"}, EnvVars: []string{"PLUGIN_CONFIG", "DOCKER_PLUGIN_CONFIG"},
Usage: "sets content of the docker daemon json config",
Destination: &settings.Login.Config, Destination: &settings.Login.Config,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "docker.purge", Name: "docker.purge",
Usage: "docker should cleanup images",
EnvVars: []string{"PLUGIN_PURGE"}, EnvVars: []string{"PLUGIN_PURGE"},
Usage: "enables cleanup of the docker environment at the end of a build",
Value: true, Value: true,
Destination: &settings.Cleanup, Destination: &settings.Cleanup,
}, },
&cli.BoolFlag{ &cli.BoolFlag{
Name: "no-cache", Name: "no-cache",
Usage: "do not use cached intermediate containers",
EnvVars: []string{"PLUGIN_NO_CACHE"}, EnvVars: []string{"PLUGIN_NO_CACHE"},
Usage: "disables the usage of cached intermediate containers",
Destination: &settings.Build.NoCache, Destination: &settings.Build.NoCache,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "add-host", Name: "add-host",
Usage: "additional host:IP mapping",
EnvVars: []string{"PLUGIN_ADD_HOST"}, EnvVars: []string{"PLUGIN_ADD_HOST"},
Usage: "sets additional host:ip mapping",
Destination: &settings.Build.AddHost, Destination: &settings.Build.AddHost,
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "platforms", Name: "platforms",
Usage: "arget platform for build",
EnvVars: []string{"PLUGIN_PLATFORMS"}, EnvVars: []string{"PLUGIN_PLATFORMS"},
Usage: "sets target platform for build",
Destination: &settings.Build.Platforms, Destination: &settings.Build.Platforms,
}, },
} }