ci: fix Docker image reference format and naming consistency
Build and Deploy / build-and-deploy (push) Successful in 1m45s
Build and Deploy / build-and-deploy (push) Successful in 1m45s
- Enforced lowercase for image owner and name to comply with Docker standards. - Switched to using the package name from package.json as the image name. - Added a unique tag using the commit SHA to improve deployment reliability.
This commit is contained in:
@@ -55,12 +55,22 @@ jobs:
|
|||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.GIT_TOKEN }}
|
password: ${{ secrets.GIT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Get image metadata
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
NAME=$(node -p "require('./package.json').name.toLowerCase()")
|
||||||
|
OWNER=$(echo "${{ gitea.actor }}" | tr '[:upper:]' '[:lower:]')
|
||||||
|
echo "name=${NAME}" >> $GITHUB_OUTPUT
|
||||||
|
echo "owner=${OWNER}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build and push image
|
- name: Build and push image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ gitea.repository }}:latest
|
tags: |
|
||||||
|
${{ env.REGISTRY }}/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.name }}:latest
|
||||||
|
${{ env.REGISTRY }}/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.name }}:${{ github.sha }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
Reference in New Issue
Block a user