0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-10 03:30:40 +00:00
wp-docker-buildx/docs/content/_index.md

3.4 KiB

title
wp-docker-buildx

Build Status Docker Hub Quay.io Go Report Card GitHub contributors Source: GitHub License: Apache-2.0

Woodpecker CI plugin to build multiarch OCI images with buildx.

{{< toc >}}

Usage

{{< hint type=important >}} Be aware that the this plugin requires privileged capabilities, otherwise the integrated Docker daemon is not able to start. {{< /hint >}}

kind: pipeline
name: default

steps:
  - name: docker
    image: quay.io/thegeeklab/wp-docker-buildx
    privileged: true
    settings:
      username: octocat
      password: secure
      repo: octocat/example
      tags: latest

Parameters

{{< propertylist name=wp-docker-buildx.data sort=name >}}

Examples

Push to other registries than DockerHub

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.

GHCR:

kind: pipeline
name: default

steps:
  - name: docker
    image: quay.io/thegeeklab/wp-docker-buildx
    privileged: true
    settings:
      registry: ghcr.io
      username: octocat
      password: secret-access-token
      repo: ghcr.io/octocat/example
      tags: latest

AWS ECR:

kind: pipeline
name: default

steps:
  - name: docker
    image: quay.io/thegeeklab/wp-docker-buildx
    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

Build

Build the binary with the following command:

make build

Build the container image with the following command:

docker build --file Containerfile.multiarch --tag thegeeklab/wp-docker-buildx .

Test

docker run --rm \
  -e PLUGIN_TAG=latest \
  -e PLUGIN_REPO=octocat/hello-world \
  -e CI_COMMIT_SHA=00000000 \
  -v $(pwd):/build:z \
  -w /build \
  --privileged \
  thegeeklab/wp-docker-buildx --dry-run