Skip to content

Commit

Permalink
add arm64 support (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandowns authored May 24, 2023
1 parent c46ea17 commit 26a2290
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 11 deletions.
54 changes: 51 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ 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:
- name: docker
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
Expand All @@ -35,7 +35,7 @@ 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:
Expand All @@ -47,4 +47,52 @@ volumes:
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:
- name: docker
path: /var/run/docker.sock

volumes:
- name: docker
host:
path: /var/run/docker.sock
...
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG TAG="v1.0.2"
ARG BCI_IMAGE=registry.suse.com/bci/bci-base:15.3.17.20.12
ARG GO_IMAGE=rancher/hardened-build-base:v1.18.1b7
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
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
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)
ORG ?= rancher
TAG ?= v1.0.2$(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
Expand Down

0 comments on commit 26a2290

Please sign in to comment.