feat: build container for multiple platforms
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Markus Pesch 2021-09-06 20:55:09 +02:00
parent 0104e01dcc
commit 227b554dbf
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 130 additions and 30 deletions

View File

@ -44,7 +44,7 @@ trigger:
---
kind: pipeline
type: docker
name: build
name: latest-amd64
platform:
os: linux
@ -52,22 +52,15 @@ platform:
steps:
- name: build
image: docker.io/volkerraschek/build-image:latest
commands:
- make container-image/build
volumes:
- name: docker_socket
path: /var/run/docker.sock
when:
branch:
- master
- name: push
image: docker.io/volkerraschek/build-image:latest
commands:
- make container-image/push
environment:
NETWORKTOOLS_IMAGE_REGISTRY_PASSWORD:
image: plugins/docker
settings:
dockerfile: Dockerfile
auto_tag: false
tags: latest-amd64
repo: volkerraschek/network-tools
username:
from_secret: container_image_registry_user
password:
from_secret: container_image_registry_password
volumes:
- name: docker_socket
@ -75,19 +68,6 @@ steps:
when:
branch:
- master
repo:
- volker.raschek/network-tools
- name: delete
image: docker.io/volkerraschek/build-image:latest
commands:
- make container-image/delete
volumes:
- name: docker_socket
path: /var/run/docker.sock
when:
branch:
- master
- name: notify
image: drillster/drone-email
@ -110,6 +90,106 @@ volumes:
host:
path: /var/run/docker.sock
trigger:
event:
exclude:
- tag
---
kind: pipeline
type: docker
name: latest-arm64
platform:
os: linux
arch: arm
steps:
- name: build
image: plugins/docker
settings:
dockerfile: Dockerfile
auto_tag: false
tags: latest-arm64
repo: volkerraschek/network-tools
username:
from_secret: container_image_registry_user
password:
from_secret: container_image_registry_password
when:
branch:
- master
- name: notify
image: drillster/drone-email
environment:
PLUGIN_HOST:
from_secret: smtp_host
PLUGIN_USERNAME:
from_secret: smtp_username
PLUGIN_PASSWORD:
from_secret: smtp_password
PLUGIN_FROM:
from_secret: smtp_mail_address
volumes:
- name: docker_socket
path: /var/run/docker.sock
when:
status:
- changed
- failure
volumes:
- name: docker_socket
host:
path: /var/run/docker.sock
trigger:
event:
exclude:
- tag
---
kind: pipeline
type: kubernetes
name: latest-manifest
steps:
- name: build-manifest
image: plugins/manifest
settings:
auto_tag: false
ignore_missing: true
spec: manifest.tmpl
username:
from_secret: container_image_registry_user
password:
from_secret: container_image_registry_password
- name: notify
image: docker.io/drillster/drone-email:latest
environment:
PLUGIN_HOST:
from_secret: smtp_host
PLUGIN_USERNAME:
from_secret: smtp_username
PLUGIN_PASSWORD:
from_secret: smtp_password
PLUGIN_FROM:
from_secret: smtp_mail_address
resources:
limits:
cpu: 50
memory: 25M
when:
status:
- changed
- failure
depends_on:
- latest-amd64
- latest-arm64
trigger:
event:
exclude:

20
manifest.tmpl Normal file
View File

@ -0,0 +1,20 @@
image: volkerraschek/network-tools:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
- "latest"
{{/if}}
manifests:
-
image: volkerraschek/network-tools:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}latest{{/if}}-amd64
platform:
architecture: amd64
os: linux
-
image: volkerraschek/network-tools:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{else}}latest{{/if}}-arm64
platform:
architecture: arm64
os: linux
variant: v8