-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(build): add multiarch support (#2)
Signed-off-by: Akhil Mohan <[email protected]>
- Loading branch information
Showing
16 changed files
with
353 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Copyright 2018-2020 The OpenEBS Authors. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: release | ||
|
||
on: | ||
create: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
provisioner-localpv: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set Tag | ||
run: | | ||
BRANCH="${GITHUB_REF##*/}" | ||
CI_TAG=${BRANCH#v}-ci | ||
if [ ${BRANCH} = "develop" ]; then | ||
CI_TAG="ci" | ||
fi | ||
echo "::set-env name=TAG::${CI_TAG}" | ||
echo "::set-env name=BRANCH::${BRANCH}" | ||
echo "BRANCH: ${BRANCH}" | ||
echo "TAG: ${CI_TAG}" | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
with: | ||
platforms: all | ||
|
||
- name: Setup Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
version: latest | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and Push Image | ||
env: | ||
IMAGE_ORG: ${{ secrets.IMAGE_ORG}} | ||
run: | | ||
make docker.buildx.provisioner-localpv | ||
make buildx.push.provisioner-localpv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
bin/ | ||
buildscripts/provisioner-localpv/provisioner-localpv | ||
/bin/ | ||
nohup.out | ||
coverage.txt | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 2020 The OpenEBS Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ifeq (${TAG}, ) | ||
export TAG=ci | ||
endif | ||
|
||
# default list of platforms for which multiarch image is built | ||
ifeq (${PLATFORMS}, ) | ||
export PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le" | ||
endif | ||
|
||
# if IMG_RESULT is unspecified, by default the image will be pushed to registry | ||
ifeq (${IMG_RESULT}, load) | ||
export PUSH_ARG="--load" | ||
# if load is specified, image will be built only for the build machine architecture. | ||
export PLATFORMS="local" | ||
else ifeq (${IMG_RESULT}, cache) | ||
# if cache is specified, image will only be available in the build cache, it won't be pushed or loaded | ||
# therefore no PUSH_ARG will be specified | ||
else | ||
export PUSH_ARG="--push" | ||
endif | ||
|
||
DOCKERX_IMAGE_PROVISIONER_LOCALPV:=${IMAGE_ORG}/provisioner-localpv:${TAG} | ||
|
||
.PHONY: docker.buildx | ||
docker.buildx: | ||
export DOCKER_CLI_EXPERIMENTAL=enabled | ||
@if ! docker buildx ls | grep -q container-builder; then\ | ||
docker buildx create --platform ${PLATFORMS} --name container-builder --use;\ | ||
fi | ||
@docker buildx build --platform ${PLATFORMS} \ | ||
-t "$(DOCKERX_IMAGE_NAME)" ${DBUILD_ARGS} -f $(PWD)/buildscripts/$(COMPONENT)/$(COMPONENT).Dockerfile \ | ||
. ${PUSH_ARG} | ||
@echo "--> Build docker image: $(DOCKERX_IMAGE_NAME)" | ||
@echo | ||
|
||
.PHONY: docker.buildx.provisioner-localpv | ||
docker.buildx.provisioner-localpv: DOCKERX_IMAGE_NAME=$(DOCKERX_IMAGE_PROVISIONER_LOCALPV) | ||
docker.buildx.provisioner-localpv: COMPONENT=$(PROVISIONER_LOCALPV) | ||
docker.buildx.provisioner-localpv: docker.buildx | ||
|
||
.PHONY: buildx.push.provisioner-localpv | ||
buildx.push.provisioner-localpv: | ||
BUILDX=true DIMAGE=${IMAGE_ORG}/provisioner-localpv ./buildscripts/push.sh |
Oops, something went wrong.