diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..6eaa7e5 --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/docker/docker/manifest.tmpl b/docker/docker/manifest.tmpl index 70e6f13..9545579 100644 --- a/docker/docker/manifest.tmpl +++ b/docker/docker/manifest.tmpl @@ -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 diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..658fdcb --- /dev/null +++ b/scripts/build.sh @@ -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 diff --git a/scripts/docker.sh b/scripts/docker.sh new file mode 100644 index 0000000..88608e1 --- /dev/null +++ b/scripts/docker.sh @@ -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 .