0
0
mirror of https://github.com/thegeeklab/github-releases-notifier.git synced 2024-11-14 08:00:40 +00:00

add multi-arch docker files

This commit is contained in:
Robert Kaussow 2020-01-14 15:08:20 +01:00
parent 3b765f347f
commit 2fbd69059e
7 changed files with 74 additions and 48 deletions

View File

@ -75,7 +75,7 @@ def linux(arch):
return {
'kind': 'pipeline',
'type': 'docker',
'name': 'linux-%s' % arch,
'name': 'build-container-%s' % arch,
'platform': {
'os': 'linux',
'arch': arch,
@ -88,7 +88,7 @@ def linux(arch):
'CGO_ENABLED': '0'
},
'commands': [
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/%s/github-releases-notifier' % arch
'go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/%s/github-releases-notifier' % arch
],
'when': {
'event': {
@ -105,7 +105,7 @@ def linux(arch):
'CGO_ENABLED': '0'
},
'commands': [
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/%s/github-releases-notifier' % arch
'go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/%s/github-releases-notifier' % arch
],
'when': {
'event': [
@ -117,7 +117,7 @@ def linux(arch):
'name': 'executable',
'image': 'golang:1.12',
'commands': [
'./release/linux/%s/github-releases-notifier --help' % arch
'./release/%s/github-releases-notifier --help' % arch
]
},
{
@ -125,8 +125,8 @@ def linux(arch):
'image': 'plugins/docker',
'settings': {
'dry_run': True,
'tags': 'linux-%s' % arch,
'dockerfile': 'docker/Dockerfile.linux.%s' % arch,
'tags': arch,
'dockerfile': 'docker/Dockerfile.%s' % arch,
'repo': 'xoxys/github-releases-notifier',
'username': {
'from_secret': 'docker_username'
@ -146,8 +146,8 @@ def linux(arch):
'image': 'plugins/docker',
'settings': {
'auto_tag': True,
'auto_tag_suffix': 'linux-%s' % arch,
'dockerfile': 'docker/Dockerfile.linux.%s' % arch,
'auto_tag_suffix': arch,
'dockerfile': 'docker/Dockerfile.%s' % arch,
'repo': 'xoxys/github-releases-notifier',
'username': {
'from_secret': 'docker_username'

View File

@ -37,7 +37,7 @@ trigger:
---
kind: pipeline
type: docker
name: linux-amd64
name: build-container-amd64
platform:
os: linux
@ -47,7 +47,7 @@ steps:
- name: build-push
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/amd64/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/amd64/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -58,7 +58,7 @@ steps:
- name: build-tag
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/amd64/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/amd64/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -68,17 +68,17 @@ steps:
- name: executable
image: golang:1.12
commands:
- ./release/linux/amd64/github-releases-notifier --help
- ./release/amd64/github-releases-notifier --help
- name: dryrun
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.linux.amd64
dockerfile: docker/Dockerfile.amd64
dry_run: true
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
tags: linux-amd64
tags: amd64
username:
from_secret: docker_username
when:
@ -89,8 +89,8 @@ steps:
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: docker/Dockerfile.linux.amd64
auto_tag_suffix: amd64
dockerfile: docker/Dockerfile.amd64
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
@ -113,7 +113,7 @@ depends_on:
---
kind: pipeline
type: docker
name: linux-arm64
name: build-container-arm64
platform:
os: linux
@ -123,7 +123,7 @@ steps:
- name: build-push
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm64/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/arm64/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -134,7 +134,7 @@ steps:
- name: build-tag
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm64/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/arm64/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -144,17 +144,17 @@ steps:
- name: executable
image: golang:1.12
commands:
- ./release/linux/arm64/github-releases-notifier --help
- ./release/arm64/github-releases-notifier --help
- name: dryrun
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.linux.arm64
dockerfile: docker/Dockerfile.arm64
dry_run: true
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
tags: linux-arm64
tags: arm64
username:
from_secret: docker_username
when:
@ -165,8 +165,8 @@ steps:
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-arm64
dockerfile: docker/Dockerfile.linux.arm64
auto_tag_suffix: arm64
dockerfile: docker/Dockerfile.arm64
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
@ -189,7 +189,7 @@ depends_on:
---
kind: pipeline
type: docker
name: linux-arm
name: build-container-arm
platform:
os: linux
@ -199,7 +199,7 @@ steps:
- name: build-push
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/linux/arm/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_COMMIT_SHA:0:8}" -a -tags netgo -o release/arm/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -210,7 +210,7 @@ steps:
- name: build-tag
image: golang:1.12
commands:
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/linux/arm/github-releases-notifier
- go build -v -ldflags "-X main.version=${DRONE_TAG##v}" -a -tags netgo -o release/arm/github-releases-notifier
environment:
CGO_ENABLED: 0
when:
@ -220,17 +220,17 @@ steps:
- name: executable
image: golang:1.12
commands:
- ./release/linux/arm/github-releases-notifier --help
- ./release/arm/github-releases-notifier --help
- name: dryrun
image: plugins/docker
settings:
dockerfile: docker/Dockerfile.linux.arm
dockerfile: docker/Dockerfile.arm
dry_run: true
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
tags: linux-arm
tags: arm
username:
from_secret: docker_username
when:
@ -241,8 +241,8 @@ steps:
image: plugins/docker
settings:
auto_tag: true
auto_tag_suffix: linux-arm
dockerfile: docker/Dockerfile.linux.arm
auto_tag_suffix: arm
dockerfile: docker/Dockerfile.arm
password:
from_secret: docker_password
repo: xoxys/github-releases-notifier
@ -296,14 +296,17 @@ trigger:
ref:
- refs/heads/master
- refs/tags/**
status:
- success
- failure
depends_on:
- linux-amd64
- linux-arm64
- linux-arm
- build-container-amd64
- build-container-arm64
- build-container-arm
---
kind: signature
hmac: 4d1e4e2ae2b63f0a0175b226233cc3694e04068ea8a5899c802de21dfa795999
hmac: c29f1291ef90ed62fa03a3788fc0e9dc03c9f76adc5adabd3097ee934aa3582b
...

View File

@ -1,12 +0,0 @@
FROM golang:1.8 as builder
ADD . /go/src/github.com/justwatchcom/github-releases-notifier
WORKDIR /go/src/github.com/justwatchcom/github-releases-notifier
RUN make build
FROM alpine:3.6
RUN apk --no-cache add ca-certificates
COPY --from=builder /go/src/github.com/justwatchcom/github-releases-notifier /bin/
ENTRYPOINT [ "/bin/github-releases-notifier" ]

5
docker/Dockerfile.amd64 Normal file
View File

@ -0,0 +1,5 @@
FROM alpine:3.10
RUN apk --no-cache add ca-certificates
ADD release/amd64/github-releases-notifier /bin/
ENTRYPOINT [ "/bin/github-releases-notifier" ]

5
docker/Dockerfile.arm Normal file
View File

@ -0,0 +1,5 @@
FROM alpine:3.10
RUN apk --no-cache add ca-certificates
ADD release/amd/github-releases-notifier /bin/
ENTRYPOINT [ "/bin/github-releases-notifier" ]

5
docker/Dockerfile.arm64 Normal file
View File

@ -0,0 +1,5 @@
FROM alpine:3.10
RUN apk --no-cache add ca-certificates
ADD release/arm64/github-releases-notifier /bin/
ENTRYPOINT [ "/bin/github-releases-notifier" ]

20
docker/manifest.tmpl Normal file
View File

@ -0,0 +1,20 @@
image: xoxys/github-releases-notifier:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: xoxys/github-releases-notifier:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- image: xoxys/github-releases-notifier:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
- image: xoxys/github-releases-notifier:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux