2022-06-02 19:48:53 +00:00
---
2023-08-13 20:08:53 +00:00
title: wp-docker-buildx
2022-06-02 19:48:53 +00:00
---
2023-08-15 21:58:07 +00:00
[![Build Status ](https://ci.thegeeklab.de/api/badges/thegeeklab/wp-docker-buildx/status.svg )](https://ci.thegeeklab.de/repos/thegeeklab/wp-docker-buildx)
2023-08-13 20:08:53 +00:00
[![Docker Hub ](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white )](https://hub.docker.com/r/thegeeklab/wp-docker-buildx)
[![Quay.io ](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white )](https://quay.io/repository/thegeeklab/wp-docker-buildx)
2023-08-15 21:58:07 +00:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/thegeeklab/wp-docker-buildx )](https://goreportcard.com/report/github.com/thegeeklab/wp-docker-buildx)
2023-08-13 20:08:53 +00:00
[![GitHub contributors ](https://img.shields.io/github/contributors/thegeeklab/wp-docker-buildx )](https://github.com/thegeeklab/wp-docker-buildx/graphs/contributors)
[![Source: GitHub ](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white )](https://github.com/thegeeklab/wp-docker-buildx)
2024-01-06 13:45:58 +00:00
[![License: Apache-2.0 ](https://img.shields.io/github/license/thegeeklab/wp-docker-buildx )](https://github.com/thegeeklab/wp-docker-buildx/blob/main/LICENSE)
2022-06-02 19:48:53 +00:00
2023-08-14 07:52:25 +00:00
Woodpecker CI plugin to build multiarch OCI images with buildx.
2022-06-02 19:48:53 +00:00
<!-- prettier - ignore - start -->
<!-- spellchecker - disable -->
{{< toc > }}
<!-- spellchecker - enable -->
<!-- prettier - ignore - end -->
## Usage
{{< hint type = important > }}
2023-11-24 21:46:43 +00:00
Be aware that the this plugin requires [privileged ](https://woodpecker-ci.org/docs/usage/workflow-syntax#privileged-mode ) capabilities, otherwise the integrated Docker daemon is not able to start.
2022-06-02 19:48:53 +00:00
{{< / hint > }}
2023-06-29 19:30:58 +00:00
```yaml
2022-06-02 19:48:53 +00:00
steps:
- name: docker
2024-01-03 20:23:07 +00:00
image: quay.io/thegeeklab/wp-docker-buildx
2022-06-02 19:48:53 +00:00
privileged: true
settings:
username: octocat
2024-03-12 19:43:33 +00:00
password: random-secret
2022-06-02 19:48:53 +00:00
repo: octocat/example
tags: latest
```
### Parameters
<!-- prettier - ignore - start -->
<!-- spellchecker - disable -->
2023-08-13 20:08:53 +00:00
{{< propertylist name = wp-docker-buildx.data sort = name > }}
2022-06-02 19:48:53 +00:00
<!-- spellchecker - enable -->
<!-- prettier - ignore - end -->
2022-12-21 08:54:17 +00:00
### Examples
2023-03-24 12:53:30 +00:00
#### Push to other registries than DockerHub
2022-12-21 08:54:17 +00:00
If the created image is to be pushed to registries other than the default DockerHub, it is necessary to set `registry` and `repo` as fully-qualified name.
2023-03-24 12:53:30 +00:00
**GHCR:**
2023-03-06 19:03:09 +00:00
2023-06-29 19:30:58 +00:00
```yaml
2022-12-21 08:54:17 +00:00
steps:
- name: docker
2024-01-03 20:23:07 +00:00
image: quay.io/thegeeklab/wp-docker-buildx
2022-12-21 08:54:17 +00:00
privileged: true
settings:
registry: ghcr.io
username: octocat
password: secret-access-token
repo: ghcr.io/octocat/example
tags: latest
```
2023-03-24 12:53:30 +00:00
**AWS ECR:**
2023-03-06 19:03:09 +00:00
2023-06-29 19:30:58 +00:00
```yaml
2023-03-06 19:03:09 +00:00
steps:
- name: docker
2024-01-03 20:23:07 +00:00
image: quay.io/thegeeklab/wp-docker-buildx
2023-03-06 19:03:09 +00:00
privileged: true
environment:
AWS_ACCESS_KEY_ID:
from_secret: aws_access_key_id
AWS_SECRET_ACCESS_KEY:
from_secret: aws_secret_access_key
settings:
registry: < account_id > .dkr.ecr.< region > .amazonaws.com
repo: < account_id > .dkr.ecr.< region > .amazonaws.com/octocat/example
tags: latest
```
2022-06-02 19:48:53 +00:00
## Build
Build the binary with the following command:
2023-06-29 19:30:58 +00:00
```shell
2022-06-02 19:48:53 +00:00
make build
```
2023-08-14 07:52:25 +00:00
Build the container image with the following command:
2022-06-02 19:48:53 +00:00
2023-06-29 19:30:58 +00:00
```shell
2023-08-14 07:42:28 +00:00
docker build --file Containerfile.multiarch --tag thegeeklab/wp-docker-buildx .
2022-06-02 19:48:53 +00:00
```
## Test
2023-06-29 19:30:58 +00:00
```shell
2022-06-02 19:48:53 +00:00
docker run --rm \
-e PLUGIN_TAG=latest \
-e PLUGIN_REPO=octocat/hello-world \
2023-08-13 20:08:53 +00:00
-e CI_COMMIT_SHA=00000000 \
2024-05-05 11:03:50 +00:00
-v $(pwd)/testdata:/build:z \
2023-08-14 07:39:28 +00:00
-w /build \
2022-06-02 19:48:53 +00:00
--privileged \
2023-08-13 20:08:53 +00:00
thegeeklab/wp-docker-buildx --dry-run
2022-06-02 19:48:53 +00:00
```