Skip to content

optimize dockerfile

optimize dockerfile #3

Workflow file for this run

name: Build and push Docker image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
jobs:
build_image:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value={{branch}}-{{sha}}-{{date 'X'}},enable=${{ startsWith(github.ref, 'refs/heads') }}
type=semver,pattern={{version}},prefix=v
type=semver,pattern={{major}}.{{minor}},prefix=v
- name: Build and push image
uses: docker/build-push-action@v5
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
push_chart:
runs-on: ubuntu-latest
needs: build_image
steps:
- name: Checkout
uses: actions/checkout@v3
- name: lint chart
run: helm lint
working-directory: chart
- name: Helm Push
uses: bsord/helm-push@v4
with:
useOCIRegistry: true
registry-url: oci://ghcr.io/${{ github.repository }}/chart
username: ${{ github.actor }}
access-token: ${{ secrets.GITHUB_TOKEN }}
force: false
chart-folder: chart