Skip to content

Update Dockerfile

Update Dockerfile #2

name: Build Fuel Prometheus Exporter
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY: ghcr.io
DOCKERFILE_DIR: .
jobs:
publish-docker-image:
runs-on: buildjet-4vcpu-ubuntu-2204
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/prometheus-fuel-exporter
tags: |
type=sha
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{raw}}
type=raw,value=sha-{{sha}}-{{date 'YYYYMMDDhhmmss'}}
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the docker.io registry
uses: docker/login-action@v2
with:
username: fuellabs
password: ${{ secrets.DOCKER_IO_READ_ONLY_TOKEN }}
- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v4
with:
context: .
file: ${{ env.DOCKERFILE_DIR }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/fuellabs/prometheus-fuel-exporter-build-cache:latest
cache-to: type=registry,ref=${{ env.REGISTRY }}/fuellabs/prometheus-fuel-exporter-build-cache:latest,mode=max