0
0
mirror of https://github.com/thegeeklab/github-releases-notifier.git synced 2024-06-02 17:49:40 +02: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 { return {
'kind': 'pipeline', 'kind': 'pipeline',
'type': 'docker', 'type': 'docker',
'name': 'linux-%s' % arch, 'name': 'build-container-%s' % arch,
'platform': { 'platform': {
'os': 'linux', 'os': 'linux',
'arch': arch, 'arch': arch,
@ -88,7 +88,7 @@ def linux(arch):
'CGO_ENABLED': '0' 'CGO_ENABLED': '0'
}, },
'commands': [ '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': { 'when': {
'event': { 'event': {
@ -105,7 +105,7 @@ def linux(arch):
'CGO_ENABLED': '0' 'CGO_ENABLED': '0'
}, },
'commands': [ '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': { 'when': {
'event': [ 'event': [
@ -117,7 +117,7 @@ def linux(arch):
'name': 'executable', 'name': 'executable',
'image': 'golang:1.12', 'image': 'golang:1.12',
'commands': [ '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', 'image': 'plugins/docker',
'settings': { 'settings': {
'dry_run': True, 'dry_run': True,
'tags': 'linux-%s' % arch, 'tags': arch,
'dockerfile': 'docker/Dockerfile.linux.%s' % arch, 'dockerfile': 'docker/Dockerfile.%s' % arch,
'repo': 'xoxys/github-releases-notifier', 'repo': 'xoxys/github-releases-notifier',
'username': { 'username': {
'from_secret': 'docker_username' 'from_secret': 'docker_username'
@ -146,8 +146,8 @@ def linux(arch):
'image': 'plugins/docker', 'image': 'plugins/docker',
'settings': { 'settings': {
'auto_tag': True, 'auto_tag': True,
'auto_tag_suffix': 'linux-%s' % arch, 'auto_tag_suffix': arch,
'dockerfile': 'docker/Dockerfile.linux.%s' % arch, 'dockerfile': 'docker/Dockerfile.%s' % arch,
'repo': 'xoxys/github-releases-notifier', 'repo': 'xoxys/github-releases-notifier',
'username': { 'username': {
'from_secret': 'docker_username' 'from_secret': 'docker_username'

View File

@ -37,7 +37,7 @@ trigger:
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: linux-amd64 name: build-container-amd64
platform: platform:
os: linux os: linux
@ -47,7 +47,7 @@ steps:
- name: build-push - name: build-push
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -58,7 +58,7 @@ steps:
- name: build-tag - name: build-tag
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -68,17 +68,17 @@ steps:
- name: executable - name: executable
image: golang:1.12 image: golang:1.12
commands: commands:
- ./release/linux/amd64/github-releases-notifier --help - ./release/amd64/github-releases-notifier --help
- name: dryrun - name: dryrun
image: plugins/docker image: plugins/docker
settings: settings:
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.amd64
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
tags: linux-amd64 tags: amd64
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -89,8 +89,8 @@ steps:
image: plugins/docker image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-amd64 auto_tag_suffix: amd64
dockerfile: docker/Dockerfile.linux.amd64 dockerfile: docker/Dockerfile.amd64
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
@ -113,7 +113,7 @@ depends_on:
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: linux-arm64 name: build-container-arm64
platform: platform:
os: linux os: linux
@ -123,7 +123,7 @@ steps:
- name: build-push - name: build-push
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -134,7 +134,7 @@ steps:
- name: build-tag - name: build-tag
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -144,17 +144,17 @@ steps:
- name: executable - name: executable
image: golang:1.12 image: golang:1.12
commands: commands:
- ./release/linux/arm64/github-releases-notifier --help - ./release/arm64/github-releases-notifier --help
- name: dryrun - name: dryrun
image: plugins/docker image: plugins/docker
settings: settings:
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.arm64
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
tags: linux-arm64 tags: arm64
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -165,8 +165,8 @@ steps:
image: plugins/docker image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm64 auto_tag_suffix: arm64
dockerfile: docker/Dockerfile.linux.arm64 dockerfile: docker/Dockerfile.arm64
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
@ -189,7 +189,7 @@ depends_on:
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: linux-arm name: build-container-arm
platform: platform:
os: linux os: linux
@ -199,7 +199,7 @@ steps:
- name: build-push - name: build-push
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -210,7 +210,7 @@ steps:
- name: build-tag - name: build-tag
image: golang:1.12 image: golang:1.12
commands: 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: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when: when:
@ -220,17 +220,17 @@ steps:
- name: executable - name: executable
image: golang:1.12 image: golang:1.12
commands: commands:
- ./release/linux/arm/github-releases-notifier --help - ./release/arm/github-releases-notifier --help
- name: dryrun - name: dryrun
image: plugins/docker image: plugins/docker
settings: settings:
dockerfile: docker/Dockerfile.linux.arm dockerfile: docker/Dockerfile.arm
dry_run: true dry_run: true
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
tags: linux-arm tags: arm
username: username:
from_secret: docker_username from_secret: docker_username
when: when:
@ -241,8 +241,8 @@ steps:
image: plugins/docker image: plugins/docker
settings: settings:
auto_tag: true auto_tag: true
auto_tag_suffix: linux-arm auto_tag_suffix: arm
dockerfile: docker/Dockerfile.linux.arm dockerfile: docker/Dockerfile.arm
password: password:
from_secret: docker_password from_secret: docker_password
repo: xoxys/github-releases-notifier repo: xoxys/github-releases-notifier
@ -296,14 +296,17 @@ trigger:
ref: ref:
- refs/heads/master - refs/heads/master
- refs/tags/** - refs/tags/**
status:
- success
- failure
depends_on: depends_on:
- linux-amd64 - build-container-amd64
- linux-arm64 - build-container-arm64
- linux-arm - build-container-arm
--- ---
kind: signature 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