mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-23 16:40:39 +00:00
docs: add parameter documentation (#53)
This commit is contained in:
parent
276f215b24
commit
2404bc12a1
17
.dictionary
Normal file
17
.dictionary
Normal 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
|
@ -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 = {
|
||||
kind: 'pipeline',
|
||||
image_pull_secrets: ['docker_config'],
|
||||
@ -320,9 +374,7 @@ local PipelineNotifications = {
|
||||
},
|
||||
],
|
||||
depends_on: [
|
||||
'build-binaries',
|
||||
'build-container-amd64',
|
||||
'build-container-arm64',
|
||||
'docs',
|
||||
],
|
||||
trigger: {
|
||||
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||
@ -335,5 +387,6 @@ local PipelineNotifications = {
|
||||
PipelineBuildBinaries,
|
||||
PipelineBuildContainer(arch='amd64'),
|
||||
PipelineBuildContainer(arch='arm64'),
|
||||
PipelineDocs,
|
||||
PipelineNotifications,
|
||||
]
|
||||
|
329
.drone.yml
329
.drone.yml
@ -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:
|
||||
- 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:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
- refs/pull/**
|
||||
|
||||
volumes:
|
||||
- name: gopath
|
||||
temp: {}
|
||||
---
|
||||
depends_on:
|
||||
- test
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
kind: pipeline
|
||||
name: build-binaries
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
os: linux
|
||||
steps:
|
||||
- name: build
|
||||
image: techknowlogick/xgo:go-1.16.x
|
||||
commands:
|
||||
- "[ -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/
|
||||
- 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/
|
||||
- ls -l /drone/src/release/
|
||||
|
||||
- name: executable
|
||||
image: alpine
|
||||
commands:
|
||||
image: techknowlogick/xgo:go-1.16.x
|
||||
name: build
|
||||
- commands:
|
||||
- $(find release/ -executable -type f | grep drone-docker-buildx-linux-amd64) --help
|
||||
|
||||
- name: compress
|
||||
image: alpine
|
||||
commands:
|
||||
name: executable
|
||||
- commands:
|
||||
- apk add upx
|
||||
- find release/ -maxdepth 1 -executable -type f -exec upx {} \;
|
||||
- ls -lh release/
|
||||
|
||||
- name: checksum
|
||||
image: alpine
|
||||
commands:
|
||||
name: compress
|
||||
- commands:
|
||||
- cd release/ && sha256sum * > sha256sum.txt
|
||||
|
||||
- name: changelog-generate
|
||||
image: thegeeklab/git-chglog
|
||||
commands:
|
||||
image: alpine
|
||||
name: checksum
|
||||
- commands:
|
||||
- git fetch -tq
|
||||
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
|
||||
|
||||
- name: changelog-format
|
||||
image: thegeeklab/alpine-tools
|
||||
commands:
|
||||
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased
|
||||
unreleased}
|
||||
image: thegeeklab/git-chglog
|
||||
name: changelog-generate
|
||||
- commands:
|
||||
- prettier CHANGELOG.md
|
||||
- prettier -w CHANGELOG.md
|
||||
|
||||
- name: publish
|
||||
image: plugins/github-release
|
||||
image: thegeeklab/alpine-tools
|
||||
name: changelog-format
|
||||
- image: plugins/github-release
|
||||
name: publish
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: github_token
|
||||
@ -112,36 +102,32 @@ steps:
|
||||
when:
|
||||
ref:
|
||||
- refs/tags/**
|
||||
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
- refs/pull/**
|
||||
|
||||
---
|
||||
depends_on:
|
||||
- test
|
||||
|
||||
---
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
kind: pipeline
|
||||
name: build-container-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
os: linux
|
||||
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
|
||||
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
|
||||
|
||||
- name: dryrun
|
||||
name: build
|
||||
- depends_on:
|
||||
- build
|
||||
image: plugins/docker:19
|
||||
name: dryrun
|
||||
settings:
|
||||
config:
|
||||
from_secret: docker_config
|
||||
@ -155,11 +141,10 @@ steps:
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
- name: publish-dockerhub
|
||||
- depends_on:
|
||||
- dryrun
|
||||
image: plugins/docker:19
|
||||
name: publish-dockerhub
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: amd64
|
||||
@ -175,11 +160,10 @@ steps:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- depends_on:
|
||||
- dryrun
|
||||
|
||||
- name: publish-quay
|
||||
image: plugins/docker:19
|
||||
name: publish-quay
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: amd64
|
||||
@ -196,38 +180,32 @@ steps:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- dryrun
|
||||
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
- refs/pull/**
|
||||
|
||||
---
|
||||
depends_on:
|
||||
- test
|
||||
|
||||
---
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
kind: pipeline
|
||||
name: build-container-arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
os: linux
|
||||
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
|
||||
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
|
||||
|
||||
- name: dryrun
|
||||
name: build
|
||||
- depends_on:
|
||||
- build
|
||||
image: plugins/docker:19
|
||||
name: dryrun
|
||||
settings:
|
||||
config:
|
||||
from_secret: docker_config
|
||||
@ -241,11 +219,10 @@ steps:
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
- name: publish-dockerhub
|
||||
- depends_on:
|
||||
- dryrun
|
||||
image: plugins/docker:19
|
||||
name: publish-dockerhub
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: arm64
|
||||
@ -261,11 +238,10 @@ steps:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- depends_on:
|
||||
- dryrun
|
||||
|
||||
- name: publish-quay
|
||||
image: plugins/docker:19
|
||||
name: publish-quay
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: arm64
|
||||
@ -282,32 +258,67 @@ steps:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- dryrun
|
||||
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
- 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
|
||||
name: notifications
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
os: linux
|
||||
steps:
|
||||
- name: manifest-dockerhub
|
||||
image: plugins/manifest
|
||||
- image: plugins/manifest
|
||||
name: manifest-dockerhub
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
@ -319,9 +330,8 @@ steps:
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: manifest-quay
|
||||
image: plugins/manifest
|
||||
- image: plugins/manifest
|
||||
name: manifest-quay
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
@ -333,10 +343,7 @@ steps:
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: pushrm-dockerhub
|
||||
image: chko/docker-pushrm:1
|
||||
environment:
|
||||
- environment:
|
||||
DOCKER_PASS:
|
||||
from_secret: docker_password
|
||||
DOCKER_USER:
|
||||
@ -344,23 +351,23 @@ steps:
|
||||
PUSHRM_FILE: README.md
|
||||
PUSHRM_SHORT: Drone plugin to build multiarch Docker images with buildx
|
||||
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
|
||||
image: chko/docker-pushrm:1
|
||||
name: pushrm-dockerhub
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: pushrm-quay
|
||||
image: chko/docker-pushrm:1
|
||||
environment:
|
||||
- environment:
|
||||
APIKEY__QUAY_IO:
|
||||
from_secret: quay_token
|
||||
PUSHRM_FILE: README.md
|
||||
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||
image: chko/docker-pushrm:1
|
||||
name: pushrm-quay
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: matrix
|
||||
image: plugins/matrix
|
||||
- image: plugins/matrix
|
||||
name: matrix
|
||||
settings:
|
||||
homeserver:
|
||||
from_secret: matrix_homeserver
|
||||
@ -368,17 +375,15 @@ steps:
|
||||
from_secret: matrix_password
|
||||
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:
|
||||
from_secret: matrix_username
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
image_pull_secrets:
|
||||
- docker_config
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
@ -386,14 +391,8 @@ trigger:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
depends_on:
|
||||
- build-binaries
|
||||
- build-container-amd64
|
||||
- build-container-arm64
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: d9ed315db5e0514b6151de65d4281802fad0882c5f71feff2f27a5686a794356
|
||||
hmac: 8dfd1d8d060f0e05affcae91a05e8d6184219c6d5f99747bcd73da0739e82c81
|
||||
|
||||
...
|
||||
|
10
.github/settings.yml
vendored
10
.github/settings.yml
vendored
@ -1,6 +1,7 @@
|
||||
repository:
|
||||
name: drone-docker-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
|
||||
|
||||
private: false
|
||||
@ -53,3 +54,12 @@ branches:
|
||||
- continuous-integration/drone/pr
|
||||
enforce_admins: 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
6
.markdownlint.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
default: True
|
||||
MD013: False
|
||||
MD041: False
|
||||
MD004:
|
||||
style: dash
|
38
README.md
38
README.md
@ -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)
|
||||
[![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`.
|
||||
|
||||
## 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
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
|
171
_docs/_index.md
Normal file
171
_docs/_index.md
Normal 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
|
@ -10,232 +10,232 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "dry-run",
|
||||
Usage: "dry run disables docker push",
|
||||
EnvVars: []string{"PLUGIN_DRY_RUN"},
|
||||
Usage: "disables docker push",
|
||||
Destination: &settings.Dryrun,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "remote.url",
|
||||
Usage: "git remote url",
|
||||
EnvVars: []string{"DRONE_REMOTE_URL"},
|
||||
Usage: "sets the git remote url",
|
||||
Destination: &settings.Build.Remote,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.mirror",
|
||||
Usage: "docker daemon registry mirror",
|
||||
EnvVars: []string{"PLUGIN_MIRROR", "DOCKER_PLUGIN_MIRROR"},
|
||||
Usage: "sets a registry mirror to pull images",
|
||||
Destination: &settings.Daemon.Mirror,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.storage-driver",
|
||||
Usage: "docker daemon storage driver",
|
||||
EnvVars: []string{"PLUGIN_STORAGE_DRIVER"},
|
||||
Usage: "sets the docker daemon storage driver",
|
||||
Destination: &settings.Daemon.StorageDriver,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.storage-path",
|
||||
Usage: "docker daemon storage path",
|
||||
Value: "/var/lib/docker",
|
||||
EnvVars: []string{"PLUGIN_STORAGE_PATH"},
|
||||
Usage: "sets the docker daemon storage path",
|
||||
Value: "/var/lib/docker",
|
||||
Destination: &settings.Daemon.StoragePath,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.bip",
|
||||
Usage: "docker daemon bride ip address",
|
||||
EnvVars: []string{"PLUGIN_BIP"},
|
||||
Usage: "allows the docker daemon to bride ip address",
|
||||
Destination: &settings.Daemon.Bip,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.mtu",
|
||||
Usage: "docker daemon custom mtu setting",
|
||||
EnvVars: []string{"PLUGIN_MTU"},
|
||||
Usage: "sets docker daemon custom mtu setting",
|
||||
Destination: &settings.Daemon.MTU,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "daemon.dns",
|
||||
Usage: "docker daemon dns server",
|
||||
EnvVars: []string{"PLUGIN_CUSTOM_DNS"},
|
||||
Usage: "sets custom docker daemon dns server",
|
||||
Destination: &settings.Daemon.DNS,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "daemon.dns-search",
|
||||
Usage: "docker daemon dns search domains",
|
||||
EnvVars: []string{"PLUGIN_CUSTOM_DNS_SEARCH"},
|
||||
Usage: "sets custom docker daemon dns search domain",
|
||||
Destination: &settings.Daemon.DNSSearch,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "daemon.insecure",
|
||||
Usage: "docker daemon allows insecure registries",
|
||||
EnvVars: []string{"PLUGIN_INSECURE"},
|
||||
Usage: "allows the docker daemon to use insecure registries",
|
||||
Destination: &settings.Daemon.Insecure,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "daemon.ipv6",
|
||||
Usage: "docker daemon IPv6 networking",
|
||||
EnvVars: []string{"PLUGIN_IPV6"},
|
||||
Usage: "enables docker daemon IPv6 support",
|
||||
Destination: &settings.Daemon.IPv6,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "daemon.experimental",
|
||||
Usage: "docker daemon Experimental mode",
|
||||
EnvVars: []string{"PLUGIN_EXPERIMENTAL"},
|
||||
Usage: "enables docker daemon experimental mode",
|
||||
Destination: &settings.Daemon.Experimental,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "daemon.debug",
|
||||
Usage: "docker daemon executes in debug mode",
|
||||
EnvVars: []string{"PLUGIN_DEBUG", "DOCKER_LAUNCH_DEBUG"},
|
||||
Usage: "enables verbose debug mode for the docker daemon",
|
||||
Destination: &settings.Daemon.Debug,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "daemon.off",
|
||||
Usage: "don't start the docker daemon",
|
||||
EnvVars: []string{"PLUGIN_DAEMON_OFF"},
|
||||
Usage: "disables the startup of the docker daemon",
|
||||
Destination: &settings.Daemon.Disabled,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "daemon.buildkit-config",
|
||||
Usage: "docker buildkit json config content",
|
||||
EnvVars: []string{"PLUGIN_BUILDKIT_CONFIG"},
|
||||
Usage: "sets content of the docker buildkit json config",
|
||||
Destination: &settings.Daemon.BuildkitConfig,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "dockerfile",
|
||||
Usage: "build dockerfile",
|
||||
Value: "Dockerfile",
|
||||
EnvVars: []string{"PLUGIN_DOCKERFILE"},
|
||||
Usage: "sets dockerfile to use for the image build",
|
||||
Value: "Dockerfile",
|
||||
Destination: &settings.Build.Dockerfile,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "context",
|
||||
Usage: "build context",
|
||||
Value: ".",
|
||||
EnvVars: []string{"PLUGIN_CONTEXT"},
|
||||
Usage: "sets the path of the build context to use",
|
||||
Value: ".",
|
||||
Destination: &settings.Build.Context,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "tags",
|
||||
Usage: "build tags",
|
||||
Value: cli.NewStringSlice([]string{"latest"}...),
|
||||
EnvVars: []string{"PLUGIN_TAG", "PLUGIN_TAGS"},
|
||||
Usage: "sets repository tags to use for the image",
|
||||
Value: cli.NewStringSlice([]string{"latest"}...),
|
||||
FilePath: ".tags",
|
||||
Destination: &settings.Build.Tags,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "tags.auto",
|
||||
Usage: "default build tags",
|
||||
EnvVars: []string{"PLUGIN_DEFAULT_TAGS", "PLUGIN_AUTO_TAG"},
|
||||
Usage: "generates tag names automatically based on git branch and git tag",
|
||||
Destination: &settings.Build.TagsAuto,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tags.suffix",
|
||||
Usage: "default build tags with suffix",
|
||||
EnvVars: []string{"PLUGIN_DEFAULT_SUFFIX", "PLUGIN_AUTO_TAG_SUFFIX"},
|
||||
Usage: "generates tag names with the given suffix",
|
||||
Destination: &settings.Build.TagsSuffix,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "args",
|
||||
Usage: "build args",
|
||||
EnvVars: []string{"PLUGIN_BUILD_ARGS"},
|
||||
Usage: "sets custom build arguments for the build",
|
||||
Destination: &settings.Build.Args,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "args-from-env",
|
||||
Usage: "build args",
|
||||
EnvVars: []string{"PLUGIN_BUILD_ARGS_FROM_ENV"},
|
||||
Usage: "forwards environment variables as custom arguments to the build",
|
||||
Destination: &settings.Build.ArgsEnv,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "quiet",
|
||||
Usage: "quiet docker build",
|
||||
EnvVars: []string{"PLUGIN_QUIET"},
|
||||
Usage: "enables suppression of the build output",
|
||||
Destination: &settings.Build.Quiet,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "target",
|
||||
Usage: "build target",
|
||||
EnvVars: []string{"PLUGIN_TARGET"},
|
||||
Usage: "sets the build target to use",
|
||||
Destination: &settings.Build.Target,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "cache-from",
|
||||
Usage: "images to consider as cache sources",
|
||||
EnvVars: []string{"PLUGIN_CACHE_FROM"},
|
||||
Usage: "sets images to consider as cache sources",
|
||||
Destination: &settings.Build.CacheFrom,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "pull-image",
|
||||
Usage: "force pull base image at build time",
|
||||
EnvVars: []string{"PLUGIN_PULL_IMAGE"},
|
||||
Usage: "enforces to pull base image at build time",
|
||||
Value: true,
|
||||
Destination: &settings.Build.Pull,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "compress",
|
||||
Usage: "compress the build context using gzip",
|
||||
EnvVars: []string{"PLUGIN_COMPRESS"},
|
||||
Usage: "enables compression og the build context using gzip",
|
||||
Destination: &settings.Build.Compress,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "repo",
|
||||
Usage: "docker repository",
|
||||
EnvVars: []string{"PLUGIN_REPO"},
|
||||
Usage: "sets repository name for the image",
|
||||
Destination: &settings.Build.Repo,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "docker.registry",
|
||||
Usage: "docker registry",
|
||||
Value: "https://index.docker.io/v1/",
|
||||
EnvVars: []string{"PLUGIN_REGISTRY", "DOCKER_REGISTRY"},
|
||||
Usage: "sets docker registry to authenticate with",
|
||||
Value: "https://index.docker.io/v1/",
|
||||
Destination: &settings.Login.Registry,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "docker.username",
|
||||
Usage: "docker username",
|
||||
EnvVars: []string{"PLUGIN_USERNAME", "DOCKER_USERNAME"},
|
||||
Usage: "sets username to authenticates with",
|
||||
Destination: &settings.Login.Username,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "docker.password",
|
||||
Usage: "docker password",
|
||||
EnvVars: []string{"PLUGIN_PASSWORD", "DOCKER_PASSWORD"},
|
||||
Usage: "sets password to authenticates with",
|
||||
Destination: &settings.Login.Password,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "docker.email",
|
||||
Usage: "docker email",
|
||||
EnvVars: []string{"PLUGIN_EMAIL", "DOCKER_EMAIL"},
|
||||
Usage: "sets email address to authenticates with",
|
||||
Destination: &settings.Login.Email,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "docker.config",
|
||||
Usage: "docker json dockerconfig content",
|
||||
EnvVars: []string{"PLUGIN_CONFIG", "DOCKER_PLUGIN_CONFIG"},
|
||||
Usage: "sets content of the docker daemon json config",
|
||||
Destination: &settings.Login.Config,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "docker.purge",
|
||||
Usage: "docker should cleanup images",
|
||||
EnvVars: []string{"PLUGIN_PURGE"},
|
||||
Usage: "enables cleanup of the docker environment at the end of a build",
|
||||
Value: true,
|
||||
Destination: &settings.Cleanup,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "no-cache",
|
||||
Usage: "do not use cached intermediate containers",
|
||||
EnvVars: []string{"PLUGIN_NO_CACHE"},
|
||||
Usage: "disables the usage of cached intermediate containers",
|
||||
Destination: &settings.Build.NoCache,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "add-host",
|
||||
Usage: "additional host:IP mapping",
|
||||
EnvVars: []string{"PLUGIN_ADD_HOST"},
|
||||
Usage: "sets additional host:ip mapping",
|
||||
Destination: &settings.Build.AddHost,
|
||||
},
|
||||
&cli.StringSliceFlag{
|
||||
Name: "platforms",
|
||||
Usage: "arget platform for build",
|
||||
EnvVars: []string{"PLUGIN_PLATFORMS"},
|
||||
Usage: "sets target platform for build",
|
||||
Destination: &settings.Build.Platforms,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user