|
| 1 | +--- |
| 2 | +title: drone-docker-buildx |
| 3 | +--- |
| 4 | + |
| 5 | +[](https://drone.thegeeklab.de/thegeeklab/drone-docker-buildx) |
| 6 | +[](https://hub.docker.com/r/thegeeklab/drone-docker-buildx) |
| 7 | +[](https://quay.io/repository/thegeeklab/drone-docker-buildx) |
| 8 | +[](https://github.com/thegeeklab/drone-docker-buildx/graphs/contributors) |
| 9 | +[](https://github.com/thegeeklab/drone-docker-buildx) |
| 10 | +[](https://github.com/thegeeklab/drone-docker-buildx/blob/main/LICENSE) |
| 11 | + |
| 12 | +Drone plugin to build and publish multiarch Docker images with buildx. |
| 13 | + |
| 14 | +<!-- prettier-ignore-start --> |
| 15 | +<!-- spellchecker-disable --> |
| 16 | +{{< toc >}} |
| 17 | +<!-- spellchecker-enable --> |
| 18 | +<!-- prettier-ignore-end --> |
| 19 | + |
| 20 | +## Versioning |
| 21 | + |
| 22 | +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. |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +{{< hint type=important >}} |
| 27 | +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. |
| 28 | +{{< /hint >}} |
| 29 | + |
| 30 | +```YAML |
| 31 | +kind: pipeline |
| 32 | +name: default |
| 33 | + |
| 34 | +steps: |
| 35 | + - name: docker |
| 36 | + image: thegeeklab/drone-docker-buildx |
| 37 | + privileged: true |
| 38 | + settings: |
| 39 | + username: octocat |
| 40 | + password: secure |
| 41 | + repo: octocat/example |
| 42 | + tags: latest |
| 43 | +``` |
| 44 | +
|
| 45 | +### Parameters |
| 46 | +
|
| 47 | +<!-- prettier-ignore-start --> |
| 48 | +<!-- spellchecker-disable --> |
| 49 | +{{< propertylist name=drone-docker-buildx.data >}} |
| 50 | +<!-- spellchecker-enable --> |
| 51 | +<!-- prettier-ignore-end --> |
| 52 | +
|
| 53 | +## Build |
| 54 | +
|
| 55 | +Build the binary with the following command: |
| 56 | +
|
| 57 | +```Shell |
| 58 | +export GOOS=linux |
| 59 | +export GOARCH=amd64 |
| 60 | +export CGO_ENABLED=0 |
| 61 | +export GO111MODULE=on |
| 62 | + |
| 63 | +make build |
| 64 | +``` |
| 65 | + |
| 66 | +Build the Docker image with the following command: |
| 67 | + |
| 68 | +```Shell |
| 69 | +docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-docker-buildx . |
| 70 | +``` |
| 71 | + |
| 72 | +## Test |
| 73 | + |
| 74 | +```Shell |
| 75 | +docker run --rm \ |
| 76 | + -e PLUGIN_TAG=latest \ |
| 77 | + -e PLUGIN_REPO=octocat/hello-world \ |
| 78 | + -e DRONE_COMMIT_SHA=00000000 \ |
| 79 | + -v $(pwd):$(pwd) \ |
| 80 | + -w $(pwd) \ |
| 81 | + --privileged \ |
| 82 | + thegeeklab/drone-docker-buildx --dry-run |
| 83 | +``` |
0 commit comments