mirror of
https://github.com/bokysan/docker-postfix.git
synced 2025-09-04 05:25:54 +08:00
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: 'Build the postfix-exporter'
|
|
description: 'Build the latest version of postfix-exporter'
|
|
|
|
inputs:
|
|
DOCKER_ACCESS_TOKEN:
|
|
description: 'DOCKER_ACCESS_TOKEN'
|
|
required: true
|
|
tags:
|
|
description: 'Docker image tags'
|
|
required: true
|
|
|
|
env:
|
|
DOCKERHUB_REPO: boky/postfix-exporter
|
|
#GHCR_REPO: ghcr.io/bokysan/postfix-exporter
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: Hsn723/postfix_exporter # Hsn723 repo is actually being updated
|
|
path: 'postfix_exporter'
|
|
ref: 'v0.7.0' # Latest commit we know that works
|
|
|
|
- name: Apply patches
|
|
shell: bash
|
|
run: |
|
|
cd postfix_exporter
|
|
git apply ../postfix-exporter-*.patch
|
|
|
|
# Buildkit setup
|
|
- uses: ./.github/actions/buildx-setup
|
|
|
|
# Docker hub login
|
|
- uses: ./.github/actions/docker-hub-login
|
|
with:
|
|
DOCKER_ACCESS_TOKEN: '${{ inputs.DOCKER_ACCESS_TOKEN }}'
|
|
|
|
# GitHub container registry login
|
|
#- name: Login to GHCR
|
|
# uses: docker/login-action@v3
|
|
# with:
|
|
# registry: ghcr.io
|
|
# username: ${{ github.repository_owner }}
|
|
# password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ env.DOCKERHUB_REPO }}
|
|
# ${{ env.GHCR_REPO }}
|
|
|
|
- name: Cache Docker layers
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-postfix-exporter-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-postfix-exporter-
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: postfix_exporter
|
|
push: true
|
|
tags: '${{ inputs.tags }}'
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: "linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/mips64le,linux/ppc64le,linux/s390x"
|
|
# linux/386,linux/arm/v6,linux/arm64,linux/riscv64"
|
|
cache-from: type=local,src=/tmp/.buildx-cache/postfix-exporter,mode=max,compression=estargz
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/postfix-exporter
|
|
|
|
- name: Move cache
|
|
shell: bash
|
|
run: |
|
|
rm -rf /tmp/.buildx-cache
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|