mirror of
https://github.com/thegeeklab/git-batch.git
synced 2024-11-21 18:40:40 +00:00
refactor: use buildx for multiarch container builds (#222)
This commit is contained in:
parent
32d1a77527
commit
5ac72e0dc9
@ -197,12 +197,12 @@ local PipelineBuildPackage = {
|
||||
},
|
||||
};
|
||||
|
||||
local PipelineBuildContainer(arch='amd64') = {
|
||||
local PipelineBuildContainer = {
|
||||
kind: 'pipeline',
|
||||
name: 'build-container-' + arch,
|
||||
name: 'build-container',
|
||||
platform: {
|
||||
os: 'linux',
|
||||
arch: arch,
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
@ -219,10 +219,13 @@ local PipelineBuildContainer(arch='amd64') = {
|
||||
image: 'thegeeklab/drone-docker-buildx:20',
|
||||
settings: {
|
||||
dry_run: true,
|
||||
dockerfile: 'docker/Dockerfile.' + arch,
|
||||
dockerfile: 'Dockerfile.multiarch',
|
||||
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||
username: { from_secret: 'docker_username' },
|
||||
password: { from_secret: 'docker_password' },
|
||||
platforms: [
|
||||
'linux/amd64',
|
||||
'linux/arm64',
|
||||
],
|
||||
provenance: false,
|
||||
},
|
||||
depends_on: ['build'],
|
||||
when: {
|
||||
@ -234,11 +237,15 @@ local PipelineBuildContainer(arch='amd64') = {
|
||||
image: 'thegeeklab/drone-docker-buildx:20',
|
||||
settings: {
|
||||
auto_tag: true,
|
||||
auto_tag_suffix: arch,
|
||||
dockerfile: 'docker/Dockerfile.' + arch,
|
||||
dockerfile: 'Dockerfile.multiarch',
|
||||
repo: 'thegeeklab/${DRONE_REPO_NAME}',
|
||||
username: { from_secret: 'docker_username' },
|
||||
password: { from_secret: 'docker_password' },
|
||||
platforms: [
|
||||
'linux/amd64',
|
||||
'linux/arm64',
|
||||
],
|
||||
provenance: false,
|
||||
},
|
||||
when: {
|
||||
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||
@ -250,12 +257,16 @@ local PipelineBuildContainer(arch='amd64') = {
|
||||
image: 'thegeeklab/drone-docker-buildx:20',
|
||||
settings: {
|
||||
auto_tag: true,
|
||||
auto_tag_suffix: arch,
|
||||
dockerfile: 'docker/Dockerfile.' + arch,
|
||||
dockerfile: 'Dockerfile.multiarch',
|
||||
registry: 'quay.io',
|
||||
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
|
||||
username: { from_secret: 'quay_username' },
|
||||
password: { from_secret: 'quay_password' },
|
||||
platforms: [
|
||||
'linux/amd64',
|
||||
'linux/arm64',
|
||||
],
|
||||
provenance: false,
|
||||
},
|
||||
when: {
|
||||
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||
@ -279,37 +290,8 @@ local PipelineNotifications = {
|
||||
arch: 'amd64',
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
image: 'plugins/manifest',
|
||||
name: 'manifest-dockerhub',
|
||||
settings: {
|
||||
ignore_missing: true,
|
||||
auto_tag: true,
|
||||
username: { from_secret: 'docker_username' },
|
||||
password: { from_secret: 'docker_password' },
|
||||
spec: 'docker/manifest.tmpl',
|
||||
},
|
||||
when: {
|
||||
status: ['success'],
|
||||
},
|
||||
},
|
||||
{
|
||||
image: 'plugins/manifest',
|
||||
name: 'manifest-quay',
|
||||
settings: {
|
||||
ignore_missing: true,
|
||||
auto_tag: true,
|
||||
username: { from_secret: 'quay_username' },
|
||||
password: { from_secret: 'quay_password' },
|
||||
spec: 'docker/manifest-quay.tmpl',
|
||||
},
|
||||
when: {
|
||||
status: ['success'],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'pushrm-dockerhub',
|
||||
pull: 'always',
|
||||
image: 'chko/docker-pushrm:1',
|
||||
environment: {
|
||||
DOCKER_PASS: {
|
||||
@ -328,7 +310,6 @@ local PipelineNotifications = {
|
||||
},
|
||||
{
|
||||
name: 'pushrm-quay',
|
||||
pull: 'always',
|
||||
image: 'chko/docker-pushrm:1',
|
||||
environment: {
|
||||
APIKEY__QUAY_IO: {
|
||||
@ -358,8 +339,7 @@ local PipelineNotifications = {
|
||||
],
|
||||
depends_on: [
|
||||
'build-package',
|
||||
'build-container-amd64',
|
||||
'build-container-arm64',
|
||||
'build-container',
|
||||
],
|
||||
trigger: {
|
||||
ref: ['refs/heads/main', 'refs/tags/**'],
|
||||
@ -372,7 +352,6 @@ local PipelineNotifications = {
|
||||
PipelineTest,
|
||||
PipelineSecurity,
|
||||
PipelineBuildPackage,
|
||||
PipelineBuildContainer(arch='amd64'),
|
||||
PipelineBuildContainer(arch='arm64'),
|
||||
PipelineBuildContainer,
|
||||
PipelineNotifications,
|
||||
]
|
||||
|
139
.drone.yml
139
.drone.yml
@ -226,7 +226,7 @@ depends_on:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: build-container-amd64
|
||||
name: build-container
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
@ -243,13 +243,13 @@ steps:
|
||||
- name: dryrun
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.amd64
|
||||
dockerfile: Dockerfile.multiarch
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
provenance: false
|
||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
@ -260,10 +260,13 @@ steps:
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: amd64
|
||||
dockerfile: docker/Dockerfile.amd64
|
||||
dockerfile: Dockerfile.multiarch
|
||||
password:
|
||||
from_secret: docker_password
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
provenance: false
|
||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
@ -278,88 +281,13 @@ steps:
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: amd64
|
||||
dockerfile: docker/Dockerfile.amd64
|
||||
password:
|
||||
from_secret: quay_password
|
||||
registry: quay.io
|
||||
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: quay_username
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- dryrun
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
- refs/pull/**
|
||||
|
||||
depends_on:
|
||||
- security
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: build-container-arm64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: python:3.11
|
||||
commands:
|
||||
- git fetch -tq
|
||||
- pip install poetry poetry-dynamic-versioning -qq
|
||||
- poetry build
|
||||
|
||||
- name: dryrun
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.arm64
|
||||
dry_run: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
ref:
|
||||
- refs/pull/**
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
- name: publish-dockerhub
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: arm64
|
||||
dockerfile: docker/Dockerfile.arm64
|
||||
password:
|
||||
from_secret: docker_password
|
||||
repo: thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
ref:
|
||||
- refs/heads/main
|
||||
- refs/tags/**
|
||||
depends_on:
|
||||
- dryrun
|
||||
|
||||
- name: publish-quay
|
||||
image: thegeeklab/drone-docker-buildx:20
|
||||
settings:
|
||||
auto_tag: true
|
||||
auto_tag_suffix: arm64
|
||||
dockerfile: docker/Dockerfile.arm64
|
||||
dockerfile: Dockerfile.multiarch
|
||||
password:
|
||||
from_secret: quay_password
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
provenance: false
|
||||
registry: quay.io
|
||||
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
|
||||
username:
|
||||
@ -389,36 +317,7 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: manifest-dockerhub
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
password:
|
||||
from_secret: docker_password
|
||||
spec: docker/manifest.tmpl
|
||||
username:
|
||||
from_secret: docker_username
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: manifest-quay
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
password:
|
||||
from_secret: quay_password
|
||||
spec: docker/manifest-quay.tmpl
|
||||
username:
|
||||
from_secret: quay_username
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
|
||||
- name: pushrm-dockerhub
|
||||
pull: always
|
||||
image: chko/docker-pushrm:1
|
||||
environment:
|
||||
DOCKER_PASS:
|
||||
@ -433,7 +332,6 @@ steps:
|
||||
- success
|
||||
|
||||
- name: pushrm-quay
|
||||
pull: always
|
||||
image: chko/docker-pushrm:1
|
||||
environment:
|
||||
APIKEY__QUAY_IO:
|
||||
@ -471,11 +369,10 @@ trigger:
|
||||
|
||||
depends_on:
|
||||
- build-package
|
||||
- build-container-amd64
|
||||
- build-container-arm64
|
||||
- build-container
|
||||
|
||||
---
|
||||
kind: signature
|
||||
hmac: c0b73cbd9e38d18a46a8ad2ca1e2d308b6bc2b12bd70f85c6193f15cbbea7e5a
|
||||
hmac: b8e7f6c15a07526af5501e13ca20abec9acf767d6f19b2d82682a1fd3f77cedc
|
||||
|
||||
...
|
||||
|
@ -1,26 +0,0 @@
|
||||
FROM arm64v8/python:3.11-alpine@sha256:941d62a7bcc71f7d25b3fa14a8121a549a72afdc4c4e06a7636b77dca1228620
|
||||
|
||||
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
|
||||
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
|
||||
LABEL org.opencontainers.image.title="git-batch"
|
||||
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/git-batch"
|
||||
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/git-batch"
|
||||
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/git-batch"
|
||||
|
||||
ENV PY_COLORS=1
|
||||
ENV TZ=UTC
|
||||
|
||||
ADD dist/git_batch-*.whl /
|
||||
|
||||
RUN apk --update add --virtual .build-deps build-base libffi-dev openssl-dev && \
|
||||
apk --update add git && \
|
||||
pip install --upgrade --no-cache-dir pip && \
|
||||
pip install --no-cache-dir $(find / -name "git_batch-*.whl") && \
|
||||
apk del .build-deps && \
|
||||
rm -f git_batch-*.whl && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
rm -rf /root/.cache/
|
||||
|
||||
USER root
|
||||
CMD []
|
||||
ENTRYPOINT ["/usr/local/bin/git-batch"]
|
@ -1,18 +0,0 @@
|
||||
image: quay.io/thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
- image: quay.io/thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
|
||||
- image: quay.io/thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
@ -1,18 +0,0 @@
|
||||
image: thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
- image: thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
|
||||
- image: thegeeklab/git-batch:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
Loading…
Reference in New Issue
Block a user