Skip to content

Commit

Permalink
feat: build images for multiple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Nov 28, 2023
1 parent ecf28ce commit 49a846e
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/build-loki-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ on:
jobs:
loki-image:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/arm
steps:
- name: pull loki code
uses: actions/checkout@v3
Expand All @@ -21,13 +28,30 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ">=1.21.3"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: set up docker buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64,linux/arm
driver: docker-container
install: true # setup docker build alias
driver-opts: --output "type=image"
- name: build image
- name: parse image metadata
id: parse-metadata
shell: bash
# TODO: this version will come from key cmd/loki in release manifest
# version=$(jq -r '."cmd/loki"' .release-please-manifest.json)
run: |
make BUILD_IN_CONTAINER=false loki-image
platform="$(echo "${{ matrix.platform}}" | sed "s/\(.*\)\/\(.*\)/\1-\2/"
echo "platform=${platform}" >> $GITHUB_OUTPUT
version="1.2.0"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Build and export
uses: docker/build-push-action@v5
with:
context: cmd/loki
platforms: ${{ matrix.platform }}
tags: grafana/loki:${{ steps.parse-metadata.outputs.version }}
outputs: type=docker,dest=/dist/loki-${{ steps.parse-metadata.outputs.version}}-${{ steps.parse-metadata.outputs.platform) }}.tar
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: loki-image-${{ matrix.platform }}
path: dist/loki-${{ steps.parse-metadata.outputs.platform) }}.tar

0 comments on commit 49a846e

Please sign in to comment.