publish amd64 images

This commit is contained in:
Brad Rydzewski 2020-11-19 14:27:09 -05:00
parent de01ca7375
commit 7f3b7a9bbb
4 changed files with 92 additions and 2 deletions

43
.drone.yml Normal file

@ -0,0 +1,43 @@
kind: pipeline
type: docker
name: default
steps:
- name: build
image: golang
commands:
- go test ./...
- sh scripts/build.sh
- name: docker
image: plugins/docker
settings:
repo: plugins/kaniko
auto_tag: true
dockerfile: docker/gcr/Dockerfile.linux.amd64
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: gcr
image: plugins/docker
settings:
repo: plugins/kaniko-gcr
auto_tag: true
dockerfile: docker/gcr/Dockerfile.linux.amd64
username:
from_secret: docker_username
password:
from_secret: docker_password
- name: ecr
image: plugins/docker
settings:
repo: plugins/kaniko-ecr
auto_tag: true
dockerfile: docker/ecr/Dockerfile.linux.amd64
username:
from_secret: docker_username
password:
from_secret: docker_password

@ -1,4 +1,4 @@
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
@ -7,7 +7,7 @@ tags:
{{/if}}
manifests:
-
image: plugins/docker:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
image: plugins/kaniko:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux

23
scripts/build.sh Executable file

@ -0,0 +1,23 @@
#!/bin/sh
# force go modules
export GOPATH=""
# disable cgo
export CGO_ENABLED=0
set -e
set -x
# linux
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/kaniko-gcr
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/kaniko-ecr
GOOS=linux GOARCH=amd64 go build -o release/linux/amd64/kaniko-docker
GOOS=linux GOARCH=arm64 go build -o release/linux/arm64/kaniko-gcr
GOOS=linux GOARCH=arm64 go build -o release/linux/arm64/kaniko-ecr
GOOS=linux GOARCH=arm64 go build -o release/linux/arm64/kaniko-docker
GOOS=linux GOARCH=arm go build -o release/linux/arm/kaniko-gcr
GOOS=linux GOARCH=arm go build -o release/linux/arm/kaniko-ecr
GOOS=linux GOARCH=arm go build -o release/linux/arm/kaniko-docker

24
scripts/docker.sh Normal file

@ -0,0 +1,24 @@
#!/bin/sh
# force go modules
export GOPATH=""
# disable cgo
export CGO_ENABLED=0
# force linux amd64 platform
export GOOS=linux
export GOARCH=amd64
set -e
set -x
# build the binary
go build -o release/linux/amd64/kaniko-gcr
go build -o release/linux/amd64/kaniko-ecr
go build -o release/linux/amd64/kaniko-docker
# build the docker image
docker build -f docker/gcr/Dockerfile.linux.amd64 -t plugins/kaniko-gcr .
docker build -f docker/ecr/Dockerfile.linux.amd64 -t plugins/kaniko-ecr .
docker build -f docker/docker/Dockerfile.linux.amd64 -t plugins/kaniko .