-
-
Save BlackHacked/fa7e5c4fe06e8eb207ab3be9a41715e4 to your computer and use it in GitHub Desktop.
multi-architecture docker pipeline in Drone CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: pipeline | |
type: docker | |
name: linux-amd64 | |
trigger: | |
branch: | |
- myapp | |
event: | |
- push | |
- custom | |
platform: | |
arch: amd64 | |
os: linux | |
clone: | |
skip_verify: yes | |
steps: | |
- name: build | |
image: docker:20-dind | |
volumes: | |
- name: dockersock | |
path: /var/run | |
commands: | |
- sleep 5 # give docker enough time to start | |
- docker build --network host -t registry.local:5000/myapp:${DRONE_COMMIT_SHA:0:8}-linux-amd64 . | |
- name: push | |
image: docker:20-dind | |
volumes: | |
- name: dockersock | |
path: /var/run | |
commands: | |
- docker push registry.local:5000/myapp:${DRONE_COMMIT_SHA:0:8}-linux-amd64 | |
services: | |
- name: docker | |
image: docker:20-dind | |
privileged: true | |
entrypoint: | |
- "dockerd" | |
volumes: | |
- name: dockersock | |
path: /var/run | |
command: | |
- "--host=unix:///var/run/docker.sock" | |
- "--insecure-registry=registry.local:5000" | |
volumes: | |
- name: dockersock | |
temp: {} | |
--- | |
kind: pipeline | |
type: docker | |
name: linux-arm64 | |
trigger: | |
branch: | |
- myapp | |
event: | |
- push | |
- custom | |
platform: | |
arch: arm64 | |
os: linux | |
clone: | |
skip_verify: yes | |
steps: | |
- name: build | |
image: docker:20-dind | |
volumes: | |
- name: dockersock | |
path: /var/run | |
commands: | |
- sleep 5 # give docker enough time to start | |
- docker build --network host -t registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8}-linux-arm64 . | |
- name: push | |
image: docker:20-dind | |
volumes: | |
- name: dockersock | |
path: /var/run | |
commands: | |
- docker push registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8}-linux-arm64 | |
services: | |
- name: docker | |
image: docker:20-dind | |
privileged: true | |
entrypoint: | |
- "dockerd" | |
volumes: | |
- name: dockersock | |
path: /var/run | |
command: | |
- "--host=unix:///var/run/docker.sock" | |
- "--insecure-registry=registry.local:5000" | |
volumes: | |
- name: dockersock | |
temp: {} | |
--- | |
kind: pipeline | |
type: docker | |
name: manifest | |
trigger: | |
branch: | |
- myapp | |
event: | |
- push | |
- custom | |
clone: | |
skip_verify: yes | |
steps: | |
- name: create && push | |
image: docker:20-dind | |
volumes: | |
- name: dockersock | |
path: /var/run | |
commands: | |
- sleep 5 # give docker enough time to start | |
- docker manifest create --insecure registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8} --amend registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8}-linux-amd64 --amend registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8}-linux-arm64 | |
- docker manifest push --insecure registry.local:5000/${DRONE_COMMIT_BRANCH}:${DRONE_COMMIT_SHA:0:8} | |
services: | |
- name: docker | |
image: docker:20-dind | |
privileged: true | |
entrypoint: | |
- "dockerd" | |
volumes: | |
- name: dockersock | |
path: /var/run | |
command: | |
- "--experimental" | |
- "--host=unix:///var/run/docker.sock" | |
- "--insecure-registry=registry.local:5000" | |
volumes: | |
- name: dockersock | |
temp: {} | |
depends_on: | |
- linux-amd64 | |
- linux-arm64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment