chore: configure dynamic image naming for frontend and backend in Docker workflow
- Added steps to dynamically set the image names for both frontend and backend based on the repository owner and name. - Updated Docker build tags to use the newly configured image names instead of hardcoded values.
This commit is contained in:
@@ -16,6 +16,14 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure backend image name
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
|
||||
name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-backend" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Prepare backend build context
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -50,8 +58,8 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ gitea.repository }}:backend-latest
|
||||
${{ env.REGISTRY }}/${{ gitea.repository }}:backend-${{ gitea.sha }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
cache-from: type=gha,scope=backend
|
||||
cache-to: type=gha,mode=max,scope=backend
|
||||
labels: |
|
||||
@@ -67,6 +75,14 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Configure frontend image name
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
owner=$(echo "${{ gitea.repository }}" | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
|
||||
name=$(echo "${{ gitea.repository }}" | cut -d/ -f2 | tr '[:upper:]' '[:lower:]')
|
||||
echo "IMAGE_NAME=${{ env.REGISTRY }}/${owner}/${name}-frontend" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Prepare frontend build context
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -107,8 +123,8 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-latest
|
||||
${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-${{ gitea.sha }}
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
cache-from: type=gha,scope=frontend
|
||||
cache-to: type=gha,mode=max,scope=frontend
|
||||
labels: |
|
||||
|
||||
Reference in New Issue
Block a user