From 2ca0313b38c73085cc2ada2820d2622349dd7b2d Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Mon, 21 Jan 2019 21:17:12 +0100 Subject: [PATCH] Add arm docker images and fix pipeline dependencies --- .drone.jsonnet | 7 +- .drone.yml | 312 ++++++++++++++++++++++++++++- docker/Dockerfile.arm | 5 +- docker/Dockerfile.arm64 | 2 +- docker/ecr/Dockerfile.linux.arm | 4 + docker/gcr/Dockerfile.linux.arm | 4 + docker/heroku/Dockerfile | 2 +- docker/heroku/Dockerfile.linux.arm | 4 + 8 files changed, 330 insertions(+), 10 deletions(-) create mode 100644 docker/ecr/Dockerfile.linux.arm create mode 100644 docker/gcr/Dockerfile.linux.arm create mode 100644 docker/heroku/Dockerfile.linux.arm diff --git a/.drone.jsonnet b/.drone.jsonnet index 4a9268f..0c7a854 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -106,7 +106,7 @@ local PipelineBuild(binary="docker", os="linux", arch="amd64") = { }, ], depends_on: [ - "testing", + if binary == "docker" then "testing" else os + "-" + arch + "-docker", ], trigger: { branch: [ "master" ], @@ -144,6 +144,7 @@ local PipelineNotifications(binary="docker") = { depends_on: [ "linux-amd64-" + binary, "linux-arm64-" + binary, + "linux-arm-" + binary, ], trigger: { branch: [ "master" ], @@ -155,12 +156,16 @@ local PipelineNotifications(binary="docker") = { PipelineTesting, PipelineBuild("docker", "linux", "amd64"), PipelineBuild("docker", "linux", "arm64"), + PipelineBuild("docker", "linux", "arm"), PipelineBuild("gcr", "linux", "amd64"), PipelineBuild("gcr", "linux", "arm64"), + PipelineBuild("gcr", "linux", "arm"), PipelineBuild("ecr", "linux", "amd64"), PipelineBuild("ecr", "linux", "arm64"), + PipelineBuild("ecr", "linux", "arm"), PipelineBuild("heroku", "linux", "amd64"), PipelineBuild("heroku", "linux", "arm64"), + PipelineBuild("heroku", "linux", "arm"), PipelineNotifications("docker"), PipelineNotifications("gcr"), PipelineNotifications("ecr"), diff --git a/.drone.yml b/.drone.yml index bbc5514..69226f2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -175,6 +175,80 @@ trigger: depends_on: - testing +--- +kind: pipeline +name: linux-arm-docker + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-docker ./cmd/drone-docker" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/docker/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/docker + tags: linux-arm + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: docker/docker/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/docker + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- testing + --- kind: pipeline name: linux-amd64-gcr @@ -247,7 +321,7 @@ trigger: - master depends_on: -- testing +- linux-amd64-docker --- kind: pipeline @@ -321,7 +395,81 @@ trigger: - master depends_on: -- testing +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-gcr + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-gcr ./cmd/drone-gcr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/gcr/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/gcr + tags: linux-arm + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: docker/gcr/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/gcr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker --- kind: pipeline @@ -395,7 +543,7 @@ trigger: - master depends_on: -- testing +- linux-amd64-docker --- kind: pipeline @@ -469,7 +617,81 @@ trigger: - master depends_on: -- testing +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-ecr + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-ecr ./cmd/drone-ecr" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/ecr/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/ecr + tags: linux-arm + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: docker/ecr/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/ecr + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker --- kind: pipeline @@ -543,7 +765,7 @@ trigger: - master depends_on: -- testing +- linux-amd64-docker --- kind: pipeline @@ -617,7 +839,81 @@ trigger: - master depends_on: -- testing +- linux-arm64-docker + +--- +kind: pipeline +name: linux-arm-heroku + +platform: + os: linux + arch: arm + +steps: +- name: build-push + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - push + - pull_request + +- name: build-tag + pull: always + image: golang:1.11 + commands: + - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -tags netgo -o release/linux/arm/drone-heroku ./cmd/drone-heroku" + environment: + CGO_ENABLED: 0 + GO111MODULE: on + when: + event: + - tag + +- name: dryrun + pull: always + image: plugins/docker:linux-arm + settings: + dockerfile: docker/heroku/Dockerfile.linux.arm + dry_run: true + password: + from_secret: docker_password + repo: plugins/heroku + tags: linux-arm + username: + from_secret: docker_username + when: + event: + - pull_request + +- name: publish + pull: always + image: plugins/docker:linux-arm + settings: + auto_tag: true + auto_tag_suffix: linux-arm + dockerfile: docker/heroku/Dockerfile.linux.arm + password: + from_secret: docker_password + repo: plugins/heroku + username: + from_secret: docker_username + when: + event: + - push + - tag + +trigger: + branch: + - master + +depends_on: +- linux-arm-docker --- kind: pipeline @@ -656,6 +952,7 @@ trigger: depends_on: - linux-amd64-docker - linux-arm64-docker +- linux-arm-docker --- kind: pipeline @@ -694,6 +991,7 @@ trigger: depends_on: - linux-amd64-gcr - linux-arm64-gcr +- linux-arm-gcr --- kind: pipeline @@ -732,6 +1030,7 @@ trigger: depends_on: - linux-amd64-ecr - linux-arm64-ecr +- linux-arm-ecr --- kind: pipeline @@ -770,5 +1069,6 @@ trigger: depends_on: - linux-amd64-heroku - linux-arm64-heroku +- linux-arm-heroku ... diff --git a/docker/Dockerfile.arm b/docker/Dockerfile.arm index b8e4bb0..310f16a 100644 --- a/docker/Dockerfile.arm +++ b/docker/Dockerfile.arm @@ -1 +1,4 @@ -# see https://github.com/docker-library/docker/issues/67 +FROM docker:18.06-dind + +ADD release/linux/arm/drone-docker /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"] diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 index 502fb4c..5fd6f01 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/Dockerfile.arm64 @@ -1,4 +1,4 @@ -FROM arm64v8/docker:18.06-dind +FROM docker:18.06-dind ADD release/linux/arm64/drone-docker /bin/ ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-docker"] diff --git a/docker/ecr/Dockerfile.linux.arm b/docker/ecr/Dockerfile.linux.arm new file mode 100644 index 0000000..f8dd9e3 --- /dev/null +++ b/docker/ecr/Dockerfile.linux.arm @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-arm + +ADD release/linux/arm/drone-ecr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-ecr"] diff --git a/docker/gcr/Dockerfile.linux.arm b/docker/gcr/Dockerfile.linux.arm new file mode 100644 index 0000000..718ce0f --- /dev/null +++ b/docker/gcr/Dockerfile.linux.arm @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-arm + +ADD release/linux/arm/drone-gcr /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-gcr"] diff --git a/docker/heroku/Dockerfile b/docker/heroku/Dockerfile index c06cdb6..e2e7e52 100644 --- a/docker/heroku/Dockerfile +++ b/docker/heroku/Dockerfile @@ -1,4 +1,4 @@ -FROM plugins/docker:latest +FROM plugins/docker:linux-amd64 ADD release/linux/amd64/drone-heroku /bin/ ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"] diff --git a/docker/heroku/Dockerfile.linux.arm b/docker/heroku/Dockerfile.linux.arm new file mode 100644 index 0000000..b233cca --- /dev/null +++ b/docker/heroku/Dockerfile.linux.arm @@ -0,0 +1,4 @@ +FROM plugins/docker:linux-arm + +ADD release/linux/arm/drone-heroku /bin/ +ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh", "/bin/drone-heroku"]