Refactor build workflow to separate backend and frontend image builds; enhance clarity and structure
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 36s
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 36s
This commit is contained in:
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Determine Image Tag
|
- name: Determine Image Tag
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ gitea.ref }}" == "refs/heads/master" ]; then
|
if [ "${{ gitea.ref }}" == "refs/heads/master" ]; then
|
||||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
@@ -26,11 +26,15 @@ jobs:
|
|||||||
id: gitea_ip
|
id: gitea_ip
|
||||||
run: |
|
run: |
|
||||||
ip=$(getent hosts gitea-server | awk '{ print $1 }')
|
ip=$(getent hosts gitea-server | awk '{ print $1 }')
|
||||||
echo "ip=$ip" >> $GITHUB_OUTPUT
|
echo "ip=$ip" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Backend Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/chore:${{ steps.vars.outputs.tag }} .
|
docker build -t ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:${{ steps.vars.outputs.tag }} ./backend
|
||||||
|
|
||||||
|
- name: Build Frontend Docker Image
|
||||||
|
run: |
|
||||||
|
docker build -t ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:${{ steps.vars.outputs.tag }} ./frontend/vue-app
|
||||||
|
|
||||||
- name: Log in to Registry
|
- name: Log in to Registry
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
@@ -39,6 +43,10 @@ jobs:
|
|||||||
username: ryan #${{ secrets.REGISTRY_USERNAME }} # Stored as a Gitea secret
|
username: ryan #${{ secrets.REGISTRY_USERNAME }} # Stored as a Gitea secret
|
||||||
password: 0x013h #${{ secrets.REGISTRY_TOKEN }} # Stored as a Gitea secret (use a PAT here)
|
password: 0x013h #${{ secrets.REGISTRY_TOKEN }} # Stored as a Gitea secret (use a PAT here)
|
||||||
|
|
||||||
- name: Push Image to Gitea Registry
|
- name: Push Backend Image to Gitea Registry
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/chore:${{ steps.vars.outputs.tag }}
|
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/backend:${{ steps.vars.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Push Frontend Image to Gitea Registry
|
||||||
|
run: |
|
||||||
|
docker push ${{ steps.gitea_ip.outputs.ip }}:3000/ryan/frontend:${{ steps.vars.outputs.tag }}
|
||||||
|
|||||||
Reference in New Issue
Block a user