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
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Prepare backend build context
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -50,8 +58,8 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ gitea.repository }}:backend-latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
${{ env.REGISTRY }}/${{ gitea.repository }}:backend-${{ gitea.sha }}
|
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||||
cache-from: type=gha,scope=backend
|
cache-from: type=gha,scope=backend
|
||||||
cache-to: type=gha,mode=max,scope=backend
|
cache-to: type=gha,mode=max,scope=backend
|
||||||
labels: |
|
labels: |
|
||||||
@@ -67,6 +75,14 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
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
|
- name: Prepare frontend build context
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -107,8 +123,8 @@ jobs:
|
|||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
${{ env.REGISTRY }}/${{ gitea.repository }}:frontend-${{ gitea.sha }}
|
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||||
cache-from: type=gha,scope=frontend
|
cache-from: type=gha,scope=frontend
|
||||||
cache-to: type=gha,mode=max,scope=frontend
|
cache-to: type=gha,mode=max,scope=frontend
|
||||||
labels: |
|
labels: |
|
||||||
|
|||||||
Reference in New Issue
Block a user