mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
build: parameterize arch builds
Build zot artifacts for multiple os and arch. [linux, amd64] - common case [linux, arm64] - raspberry pi [darwin, amd64] - Intel-based macs [darwin, arm64] - Arm-based macs Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
d2aa016cdb
commit
298b966eab
+39
-58
@@ -13,6 +13,10 @@ jobs:
|
||||
build-test:
|
||||
name: Build and test ZOT
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [linux, darwin]
|
||||
arch: [amd64, arm64]
|
||||
services:
|
||||
s3mock:
|
||||
image: ghcr.io/project-zot/localstack/localstack:0.13.2
|
||||
@@ -46,15 +50,23 @@ jobs:
|
||||
- name: Run build and test
|
||||
timeout-minutes: 60
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE && make && make ARCH=arm64 binary-arch-minimal && make ARCH=arm64 binary-arch
|
||||
echo "Building for $OS:$ARCH"
|
||||
cd $GITHUB_WORKSPACE
|
||||
if [ "${OS}" == "linux" && "${ARCH}" == "amd64" ]; then
|
||||
make OS=$OS ARCH=$ARCH
|
||||
else
|
||||
make OS=$OS ARCH=$ARCH binary binary-minimal binary-debug cli bench exporter-minimal
|
||||
fi
|
||||
env:
|
||||
S3MOCK_ENDPOINT: localhost:4566
|
||||
AWS_ACCESS_KEY_ID: fake
|
||||
AWS_SECRET_ACCESS_KEY: fake
|
||||
OS: ${{ matrix.os }}
|
||||
ARCH: ${{ matrix.arch }}
|
||||
|
||||
- name: Upload code coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
uses: codecov/codecov-action@v1
|
||||
|
||||
- if: github.event_name == 'release' && github.event.action == 'published'
|
||||
name: Publish artifacts on releases
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
@@ -69,6 +81,10 @@ jobs:
|
||||
if: github.event_name == 'release' && github.event.action== 'published'
|
||||
name: Push Docker image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [linux, darwin]
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
@@ -78,86 +94,51 @@ jobs:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build container image
|
||||
- name: Build zot container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
- name: Build minimal container image
|
||||
ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zot-minimal container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-minimal
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-minimal:latest
|
||||
ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-minimal-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zot-exporter container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zxp:latest
|
||||
- name: Build zot-exporter container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:latest
|
||||
- name: Build container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64:latest
|
||||
- name: Build minimal container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-minimal
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64-minimal:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64-minimal:latest
|
||||
- name: Build container image
|
||||
ghcr.io/${{ github.repository }}-zxp-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zxp-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
- name: Build zb container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
OS=${{ matrix.os }}
|
||||
ARCH=${{ matrix.arch }}
|
||||
push: true
|
||||
file: Dockerfile-zb
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
- name: Build container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-zb
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64:latest
|
||||
ghcr.io/${{ github.repository }}-zb-${{ matrix.os }}-${{ matrix.arch }}:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zb-${{ matrix.os }}-${{ matrix.arch }}:latest
|
||||
|
||||
Reference in New Issue
Block a user