From f9d1b3e765fa86d128ce603979281f6c1ab1dfe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Czapli=C5=84ski?= Date: Sat, 23 May 2020 17:40:04 +0200 Subject: [PATCH] Added manifest tool and multi arch build (#3) --- .iceci.yaml | 72 +++++++++++++++++++++++++++++++++++++++++--- Makefile | 16 ---------- README.md | 2 +- utils-arm.Dockerfile | 7 ----- utils/Dockerfile | 12 ++++++-- 5 files changed, 79 insertions(+), 30 deletions(-) delete mode 100644 Makefile delete mode 100644 utils-arm.Dockerfile diff --git a/.iceci.yaml b/.iceci.yaml index 7bf88a9..eea693b 100644 --- a/.iceci.yaml +++ b/.iceci.yaml @@ -1,11 +1,75 @@ steps: -- name: docker-build - dockerBuild: +- name: docker-build-amd64 + runtimeProfile: amd64 + when: + event: ["commit", "tag"] + containerBuild: user: iceci imageName: utils dockerSecret: dockerhub contextPath: utils dockerfilePath: utils/Dockerfile tags: - - "3" - - latest + - "{{ ICE_GIT_TAG_OR_BRANCH }}-amd64" + - "latest-amd64" + buildArgs: + - name: BIN_ARCH + value: amd64 + + +- name: docker-build-arm + runtimeProfile: arm + when: + event: ["commit", "tag"] + containerBuild: + user: iceci + imageName: utils + dockerSecret: dockerhub + contextPath: utils + dockerfilePath: utils/Dockerfile + tags: + - "{{ ICE_GIT_TAG_OR_BRANCH }}-arm" + - "latest-arm" + buildArgs: + - name: BIN_ARCH + value: armv7 + + +- name: docker-build-arm64 + runtimeProfile: arm64 + when: + event: ["commit", "tag"] + containerBuild: + user: iceci + imageName: utils + dockerSecret: dockerhub + contextPath: utils + dockerfilePath: utils/Dockerfile + tags: + - "{{ ICE_GIT_TAG_OR_BRANCH }}-arm64" + - "latest-arm64" + buildArgs: + - name: BIN_ARCH + value: arm64 + + +- name: manifest-push + when: + event: ["commit", "tag"] + containerRun: + image: iceci/utils + script: | + echo "pushing manifest for tag/branch ${ICE_GIT_TAG_OR_BRANCH}" + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm,linux/arm64 \ + --template "iceci/utils:${ICE_GIT_TAG_OR_BRANCH}-ARCH" \ + --target "iceci/utils:${ICE_GIT_TAG_OR_BRANCH}" + + echo "pushing manifest for tag latest" + manifest-tool push from-args \ + --platforms linux/amd64,linux/arm,linux/arm64 \ + --template "iceci/utils:latest-ARCH" \ + --target "iceci/utils:latest" + files: + - path: /root/.docker/config.json + fromSecret: docker-config diff --git a/Makefile b/Makefile deleted file mode 100644 index ecc5779..0000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -SHELL=/bin/bash - -REGISTRY?=docker.io -ORGANISATION?=iceci -IMG_VER?=2 - -.PHONY: build-utils build-utils-arm - -UTILS_IMG:=$(REGISTRY)/$(ORGANISATION)/utils -build-utils: - docker build -t $(UTILS_IMG):$(IMG_VER) -f utils.Dockerfile . - docker push $(UTILS_IMG):$(IMG_VER) - -build-utils-arm: - docker build -t $(UTILS_IMG)-arm:$(IMG_VER) -f utils-arm.Dockerfile . - docker push $(UTILS_IMG)-arm:$(IMG_VER) diff --git a/README.md b/README.md index 854936c..783d7f8 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ This repo contains docker files for images used by IceCI pipelines. --- -_Kept cool 🧊 by [Icetek](https://icetek.io/)_ +Kept cool 🧊 by [Icetek](https://icetek.io/) diff --git a/utils-arm.Dockerfile b/utils-arm.Dockerfile deleted file mode 100644 index 29eaa44..0000000 --- a/utils-arm.Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM arm32v7/debian:10 -RUN apt-get update && apt-get install -y apt-transport-https curl gnupg && \ - curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list && \ - apt-get update && \ - apt-get install -y git kubectl=1.17.4-00 && \ - apt-get autoclean diff --git a/utils/Dockerfile b/utils/Dockerfile index e0c2831..ed1e363 100644 --- a/utils/Dockerfile +++ b/utils/Dockerfile @@ -1,7 +1,15 @@ -FROM debian:10 -RUN apt-get update && apt-get install -y apt-transport-https curl gnupg && \ +ARG DEBIAN_VER=10 +FROM debian:${DEBIAN_VER} + +ARG BIN_ARCH=amd64 +ARG MANIFEST_TOOL_VER=v1.0.2 + +RUN apt-get update && apt-get install -y wget apt-transport-https curl gnupg && \ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list && \ apt-get update && \ apt-get install -y git kubectl=1.17.4-00 && \ + wget https://github.com/estesp/manifest-tool/releases/download/${MANIFEST_TOOL_VER}/manifest-tool-linux-${BIN_ARCH} \ + -O /usr/local/bin/manifest-tool && \ + chmod +x /usr/local/bin/manifest-tool && \ apt-get autoclean