Skip to content

Bump library/alpine from 3.18.2 to 3.18.5 #715

Bump library/alpine from 3.18.2 to 3.18.5

Bump library/alpine from 3.18.2 to 3.18.5 #715

Workflow file for this run

name: Docker image build and push
on:
pull_request:
types: [ closed ]
push:
branches:
- 'master'
jobs:
build-latest:
if: ${{ github.event.pull_request.merged == true || ( github.ref == 'refs/heads/master' && github.event_name == 'push' ) }}
name: Build latest Image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64, 386]
steps:
- uses: actions/checkout@v4
- name: Prepare multiarch
run: sudo podman run --rm --privileged docker.io/tonistiigi/binfmt --install all
- name: Build latest image
id: build-latest-image
uses: redhat-actions/[email protected]
with:
image: loki
archs: ${{ matrix.arch }}
tags: latest-${{ matrix.arch }}
containerfiles: |
./Dockerfile
build-args: |
VERSION=master
GOARCH=${{ matrix.arch }}
layers: true
- name: Push latest image to ghcr
uses: redhat-actions/[email protected]
with:
image: ${{ steps.build-latest-image.outputs.image }}
tags: ${{ steps.build-latest-image.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
build-version:
if: ${{ github.event.pull_request.merged == true || ( github.ref == 'refs/heads/master' && github.event_name == 'push' ) }}
outputs:
version: ${{ steps.loki-version.outputs.version }}
name: Build Version Image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64, 386]
steps:
- uses: actions/checkout@v4
- name: Get latest Loki release
id: loki-version
run: |
export LOKI_LATEST=$(curl -s "https://api.github.com/repos/grafana/loki/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")')
echo "VERSION=$LOKI_LATEST" >> ${GITHUB_ENV}
echo "version=$LOKI_LATEST" >> ${GITHUB_OUTPUT}
shell: bash
- name: check if latest loki is already a package version
id: get_versions
uses: octokit/[email protected]
with:
route: GET /user/packages/container/loki/versions
env:
GITHUB_TOKEN: ${{ secrets.PACKAGES }}
- run: |
export LOKI_AVAIL=$(echo "${{ steps.get_versions.outputs.data }}"|grep -Po "${VERSION}"|head -1)
echo "AVAIL=$LOKI_AVAIL" >> ${GITHUB_ENV}
- name: Prepare multiarch
run: sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: env.VERSION != env.AVAIL
- name: Build version image
id: build-version-image
uses: redhat-actions/[email protected]
with:
image: loki
archs: ${{ matrix.arch }}
tags: ${{ env.VERSION }}-${{ matrix.arch }}
dockerfiles: |
./Dockerfile
build-args: |
VERSION=${{ env.VERSION }}
GOARCH=${{ matrix.arch }}
if: env.VERSION != env.AVAIL
- name: Push version image to ghcr
uses: redhat-actions/[email protected]
with:
image: ${{ steps.build-version-image.outputs.image }}
tags: ${{ steps.build-version-image.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: env.VERSION != env.AVAIL
create-manifest-latest:
needs: build-latest
if: ${{ github.event.pull_request.merged == true || ( github.ref == 'refs/heads/master' && github.event_name == 'push' ) }}
name: Create manifest for latest image
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: pull latest images
run: |
docker pull ghcr.io/${{ github.repository_owner }}/loki:latest-arm64
docker pull ghcr.io/${{ github.repository_owner }}/loki:latest-amd64
docker pull ghcr.io/${{ github.repository_owner }}/loki:latest-386
- name: create latest manifest list
run: |
docker manifest create ghcr.io/${{ github.repository_owner }}/loki:latest ghcr.io/${{ github.repository_owner }}/loki:latest-arm64 ghcr.io/${{ github.repository_owner }}/loki:latest-amd64 ghcr.io/${{ github.repository_owner }}/loki:latest-386
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:latest ghcr.io/${{ github.repository_owner }}/loki:latest-arm64 --arch arm64
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:latest ghcr.io/${{ github.repository_owner }}/loki:latest-amd64 --arch amd64
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:latest ghcr.io/${{ github.repository_owner }}/loki:latest-386 --arch 386
- name: push latest manifest
run: |
docker manifest push ghcr.io/${{ github.repository_owner }}/loki:latest
create-manifest-version:
needs: build-version
if: ${{ github.event.pull_request.merged == true || ( github.ref == 'refs/heads/master' && github.event_name == 'push' ) }}
name: Create manifest for version image
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: pull version images
run: |
docker pull ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-arm64
docker pull ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-amd64
docker pull ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-386
- name: create version manifest list
run: |
docker manifest create ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}} ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-arm64 ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-amd64 ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-386
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}} ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-arm64 --arch arm64
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}} ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-amd64 --arch amd64
docker manifest annotate ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}} ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}-386 --arch 386
- name: push version manifest
run: |
docker manifest push ghcr.io/${{ github.repository_owner }}/loki:${{needs.build-version.outputs.version}}