This commit is contained in:
Luke Gustafson
2024-11-27 00:38:14 +00:00
parent 37f817fbb4
commit b06fcb47bd
3 changed files with 47 additions and 21 deletions

View File

@@ -1,8 +1,3 @@
name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
@@ -10,17 +5,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies and build frontend
run: |
cd frontend
npm install
npm run build
ls -R . # Debugging: List files in frontend after build
- name: Debug workspace structure
run: ls -R /github/workspace # Debugging: Verify where `dist` is created
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker login to GHCR
uses: docker/login-action@v2
with:
@@ -28,14 +25,9 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate docker tag
id: prep
run: |
echo "REPO_NAME=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "DATE_TAG=$(date +%s)" >> $GITHUB_ENV
- name: Build Docker image
run: docker build -f docker/Dockerfile . --tag ghcr.io/$REPO_NAME/ssh-project:$DATE_TAG
run: |
docker build -f docker/Dockerfile . --tag ghcr.io/$REPO_NAME/ssh-project:$DATE_TAG
- name: Push Docker image to GHCR
run: docker push ghcr.io/$REPO_NAME/ssh-project:$DATE_TAG
run: docker push ghcr.io/$REPO_NAME/ssh-project:$DATE_TAG