From 7c4c975623715989a73310d24aee4a868fe64ee8 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Tue, 9 May 2023 16:20:27 -0700 Subject: [PATCH] add arm64 support Signed-off-by: Brian Downs --- .drone.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++--- Dockerfile | 8 ++++---- Makefile | 14 ++++++++++---- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/.drone.yml b/.drone.yml index ea29708..ec1d99d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,7 +10,7 @@ platform: steps: - name: build pull: always - image: rancher/hardened-build-base:v1.16.10b7 + image: rancher/hardened-build-base:v1.20.4b11 commands: - make DRONE_TAG=${DRONE_TAG} volumes: @@ -18,7 +18,7 @@ steps: path: /var/run/docker.sock - name: publish - image: rancher/hardened-build-base:v1.16.10b7 + image: rancher/hardened-build-base:v1.20.4b11 commands: - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - make DRONE_TAG=${DRONE_TAG} image-push image-manifest @@ -35,7 +35,56 @@ steps: - tag - name: scan - image: rancher/hardened-build-base:v1.16.10b7 + image: rancher/hardened-build-base:v1.20.4b11 + commands: + - make DRONE_TAG=${DRONE_TAG} image-scan + volumes: + - name: docker + path: /var/run/docker.sock + +volumes: +- name: docker + host: + path: /var/run/docker.sock + +--- +kind: pipeline +type: docker +name: linux-arm64 + +platform: + os: linux + arch: arm64 + +steps: +- name: build + pull: always + image: rancher/hardened-build-base:v1.20.4b11 + commands: + - make DRONE_TAG=${DRONE_TAG} + volumes: + - name: docker + path: /var/run/docker.sock + +- name: publish + image: rancher/hardened-build-base:v1.20.4b11 + commands: + - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + - make DRONE_TAG=${DRONE_TAG} image-push image-manifest + environment: + DOCKER_PASSWORD: + from_secret: docker_password + DOCKER_USERNAME: + from_secret: docker_username + volumes: + - name: docker + path: /var/run/docker.sock + when: + event: + - tag + +- name: scan + image: rancher/hardened-build-base:v1.20.4b11 commands: - make DRONE_TAG=${DRONE_TAG} image-scan volumes: diff --git a/Dockerfile b/Dockerfile index ca49d59..b31db8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ ARG TAG="2.6.3" -ARG BCI_IMAGE=registry.suse.com/bci/bci-base:15.3.17.20.12 -ARG GO_IMAGE=rancher/hardened-build-base:v1.18.5b7 +ARG BCI_IMAGE=registry.suse.com/bci/bci-base +ARG GO_IMAGE=rancher/hardened-build-base:v1.20.4b11 # Build the project FROM ${GO_IMAGE} as builder -RUN set -x \ - && apk --no-cache add \ +RUN set -x && \ + apk --no-cache add \ git \ make ARG TAG diff --git a/Makefile b/Makefile index 8a94291..0de6d76 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ SEVERITIES = HIGH,CRITICAL -ifeq ($(ARCH),) -ARCH=$(shell go env GOARCH) +UNAME_M = $(shell uname -m) +ARCH= +ifeq ($(UNAME_M), x86_64) + ARCH=amd64 +else ifeq ($(UNAME_M), aarch64) + ARCH=arm64 +else + ARCH=$(UNAME_M) endif BUILD_META=-build$(shell date +%Y%m%d) @@ -9,11 +15,11 @@ ORG ?= rancher TAG ?= v2.6.3$(BUILD_META) ifneq ($(DRONE_TAG),) -TAG := $(DRONE_TAG) + TAG := $(DRONE_TAG) endif ifeq (,$(filter %$(BUILD_META),$(TAG))) -$(error TAG needs to end with build metadata: $(BUILD_META)) + $(error TAG needs to end with build metadata: $(BUILD_META)) endif .PHONY: image-build