Fix helm chart when no env vars are specified (#812) #638
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
name: Docker Build | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
- '*docker*' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+*' # Semver matching pattern with optional suffix | |
permissions: | |
packages: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
include: | |
- platform: linux/amd64 | |
runs_on: buildjet-32vcpu-ubuntu-2204 | |
arch: amd64 | |
- platform: linux/arm64 | |
runs_on: buildjet-32vcpu-ubuntu-2204-arm | |
arch: arm64 | |
runs-on: ${{ matrix.runs_on }} | |
steps: | |
- name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# arroyo-single | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/arroyosystems/arroyo-single | |
- name: Build and push single | |
id: build-single | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
platforms: ${{ matrix.platform }} | |
build-args: | | |
GIT_SHA=${{ github.sha }} | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
cache-to: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
# note that this is now the same as arroyo | |
target: arroyo | |
outputs: type=image,name=ghcr.io/arroyosystems/arroyo-single,push-by-digest=true,name-canonical=true,push=true,store=true | |
# arroyo | |
- name: Docker meta | |
id: meta-arroyo | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/arroyosystems/arroyo | |
- name: Build and push arroyo | |
id: build-arroyo | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
platforms: ${{ matrix.platform }} | |
build-args: | | |
GIT_SHA=${{ github.sha }} | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
cache-to: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
target: arroyo | |
outputs: type=image,name=ghcr.io/arroyosystems/arroyo,push-by-digest=true,name-canonical=true,push=true,store=true | |
# arroyo-full | |
- name: Docker meta | |
id: meta-arroyo-full | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/arroyosystems/arroyo-full | |
- name: Build and push arroyo-full | |
id: build-arroyo-full | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/Dockerfile | |
platforms: ${{ matrix.platform }} | |
build-args: | | |
GIT_SHA=${{ github.sha }} | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
cache-to: type=registry,ref=ghcr.io/arroyosystems/arroyo-builder:buildcache-${{ matrix.arch }} | |
target: arroyo-full | |
outputs: type=image,name=ghcr.io/arroyosystems/arroyo-full,push-by-digest=true,name-canonical=true,push=true,store=true | |
- name: Export digest | |
run: | | |
mkdir -p /tmp/digests/arroyo-single | |
digest="${{ steps.build-single.outputs.digest }}" | |
touch "/tmp/digests/arroyo-single/${digest#sha256:}" | |
mkdir -p /tmp/digests/arroyo | |
digest="${{ steps.build-arroyo.outputs.digest }}" | |
touch "/tmp/digests/arroyo/${digest#sha256:}" | |
mkdir -p /tmp/digests/arroyo-full | |
digest="${{ steps.build-arroyo-full.outputs.digest }}" | |
touch "/tmp/digests/arroyo-full/${digest#sha256:}" | |
- name: Upload digest | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-${{ env.PLATFORM_PAIR }} | |
path: /tmp/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
manifest: | |
needs: build | |
strategy: | |
matrix: | |
image_name: | |
- arroyo | |
- arroyo-single | |
- arroyo-full | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Download digests | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/digests | |
pattern: digests-* | |
merge-multiple: true | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/arroyosystems/${{ matrix.image_name }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Create manifest list and push | |
working-directory: /tmp/digests/${{ matrix.image_name }} | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf 'ghcr.io/arroyosystems/${{ matrix.image_name }}@sha256:%s ' *) | |
- | |
name: Inspect image | |
run: | | |
docker buildx imagetools inspect ghcr.io/arroyosystems/${{ matrix.image_name }}:${{ steps.meta.outputs.version }} | |
- name: Push to tip tag. | |
working-directory: /tmp/digests/${{ matrix.image_name }} | |
if: github.ref == 'refs/heads/master' | |
run: | | |
docker buildx imagetools create --tag ghcr.io/arroyosystems/${{ matrix.image_name }}:tip \ | |
$(printf 'ghcr.io/arroyosystems/${{ matrix.image_name }}@sha256:%s ' *) |