pls docker image 🙏🏻

This commit is contained in:
Kaarel 2026-01-20 20:58:52 +00:00
parent 84b907c012
commit a847a86371
No known key found for this signature in database

65
.github/workflows/docker-publish.yml vendored Normal file
View file

@ -0,0 +1,65 @@
name: Build and Push Docker Image
on:
push:
branches:
- master
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.1
- name: Get version from package.json
id: package-version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.12.0
- name: Log in to Container Registry
uses: docker/login-action@v3.6.0
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.10.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Set latest tag for master branch
type=raw,value=latest,enable={{is_default_branch}}
# Use version from package.json
type=raw,value=${{ steps.package-version.outputs.version }}
# Use short SHA
type=sha,prefix=
# Use git tag if present
type=ref,event=tag
- name: Build and push Docker image
uses: docker/build-push-action@v6.18.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64