refactor: use buildx for multiarch container builds (#16)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2023-01-15 17:09:08 +01:00
parent 0331e7341e
commit 70d68e6082
2 changed files with 7 additions and 165 deletions

View File

@ -1,156 +0,0 @@
local PipelineTest = {
kind: 'pipeline',
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'markdownlint',
image: 'thegeeklab/markdownlint-cli',
commands: [
"markdownlint 'README.md'",
],
},
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(version='7') = {
kind: 'pipeline',
name: 'build-container-el' + version,
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'dryrun',
image: 'thegeeklab/drone-docker-buildx:20',
pull: 'always',
settings: {
dry_run: true,
dockerfile: 'Dockerfile.el' + version,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
tags: version,
},
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish-dockerhub',
image: 'thegeeklab/drone-docker-buildx:20',
pull: 'always',
settings: {
dockerfile: 'Dockerfile.el' + version,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
tags: version,
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
},
{
name: 'publish-quay',
image: 'thegeeklab/drone-docker-buildx:20',
pull: 'always',
settings: {
dockerfile: 'Dockerfile.el' + version,
registry: 'quay.io',
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
tags: version,
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = {
kind: 'pipeline',
name: 'notifications',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'pushrm-dockerhub',
pull: 'always',
image: 'chko/docker-pushrm:1',
environment: {
DOCKER_PASS: {
from_secret: 'docker_password',
},
DOCKER_USER: {
from_secret: 'docker_username',
},
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'Rootless Alpine base image',
PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-quay',
pull: 'always',
image: 'chko/docker-pushrm:1',
environment: {
APIKEY__QUAY_IO: {
from_secret: 'quay_token',
},
PUSHRM_FILE: 'README.md',
PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'matrix',
image: 'thegeeklab/drone-matrix',
settings: {
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}',
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [
'build-container-el7',
'build-container-el8',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[
PipelineTest,
PipelineBuildContainer(version='7'),
PipelineBuildContainer(version='8'),
PipelineNotifications,
]

View File

@ -28,19 +28,18 @@ platform:
steps: steps:
- name: dryrun - name: dryrun
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el7 dockerfile: Dockerfile.el7
dry_run: true dry_run: true
repo: thegeeklab/${DRONE_REPO_NAME} repo: thegeeklab/${DRONE_REPO_NAME}
tags: 7 tags: 7
provenance: false
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
- name: publish-dockerhub - name: publish-dockerhub
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el7 dockerfile: Dockerfile.el7
@ -50,13 +49,13 @@ steps:
tags: 7 tags: 7
username: username:
from_secret: docker_username from_secret: docker_username
provenance: false
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- name: publish-quay - name: publish-quay
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el7 dockerfile: Dockerfile.el7
@ -67,6 +66,7 @@ steps:
tags: 7 tags: 7
username: username:
from_secret: quay_username from_secret: quay_username
provenance: false
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
@ -91,19 +91,18 @@ platform:
steps: steps:
- name: dryrun - name: dryrun
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el8 dockerfile: Dockerfile.el8
dry_run: true dry_run: true
repo: thegeeklab/${DRONE_REPO_NAME} repo: thegeeklab/${DRONE_REPO_NAME}
tags: 8 tags: 8
provenance: false
when: when:
ref: ref:
- refs/pull/** - refs/pull/**
- name: publish-dockerhub - name: publish-dockerhub
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el8 dockerfile: Dockerfile.el8
@ -113,13 +112,13 @@ steps:
tags: 8 tags: 8
username: username:
from_secret: docker_username from_secret: docker_username
provenance: false
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
- refs/tags/** - refs/tags/**
- name: publish-quay - name: publish-quay
pull: always
image: thegeeklab/drone-docker-buildx:20 image: thegeeklab/drone-docker-buildx:20
settings: settings:
dockerfile: Dockerfile.el8 dockerfile: Dockerfile.el8
@ -130,6 +129,7 @@ steps:
tags: 8 tags: 8
username: username:
from_secret: quay_username from_secret: quay_username
provenance: false
when: when:
ref: ref:
- refs/heads/main - refs/heads/main
@ -154,7 +154,6 @@ platform:
steps: steps:
- name: pushrm-dockerhub - name: pushrm-dockerhub
pull: always
image: chko/docker-pushrm:1 image: chko/docker-pushrm:1
environment: environment:
DOCKER_PASS: DOCKER_PASS:
@ -169,7 +168,6 @@ steps:
- success - success
- name: pushrm-quay - name: pushrm-quay
pull: always
image: chko/docker-pushrm:1 image: chko/docker-pushrm:1
environment: environment:
APIKEY__QUAY_IO: APIKEY__QUAY_IO:
@ -211,6 +209,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: 435b8dcaca7ddabe92447d3213768861db7a13bec278c6b97b12f751af204ec1 hmac: d82532e62c20d50e32e20d34a6836919cb91b0fec07a1a1ee67c01ba6b6478da
... ...