Docker build update #8 (nevermind not finanl)

This commit is contained in:
LukeGus
2024-12-07 01:49:32 -06:00
parent 0f764dfb98
commit bc49d646b3
3 changed files with 27 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
name: Build and Push Docker Image
on:
push:
branches:
@@ -22,10 +23,18 @@ jobs:
with:
node-version: '18'
- name: Cache Node Modules
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install Dependencies and Build Frontend
run: |
cd frontend
npm install
npm ci
npm run build
- name: Setup Docker Buildx
@@ -45,10 +54,8 @@ jobs:
run: |
echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
if [ "${{ github.event.inputs.tag_name }}" == "" ]; then
# If the tag_name input is an empty string, default to branch-name-development-latest
IMAGE_TAG="${{ github.ref_name }}-development-latest"
else
# If tag_name is provided, use it
IMAGE_TAG="${{ github.event.inputs.tag_name }}"
fi
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
@@ -61,8 +68,8 @@ jobs:
push: true
tags: ghcr.io/${{ env.REPO_OWNER }}/ssh-project:${{ env.IMAGE_TAG }}
labels: org.opencontainers.image.source=https://github.com/${{ github.repository }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=gha,ref=ghcr.io/${{ env.REPO_OWNER }}/ssh-project:cache
cache-to: type=gha,mode=max,ref=ghcr.io/${{ env.REPO_OWNER }}/ssh-project:cache
- name: Notify via ntfy
run: |