fix: use direct Docker build to avoid runner filesystem issues
CI/CD Pipeline / Build & Deploy (push) Failing after 24s
CI/CD Pipeline / Build & Deploy (push) Failing after 24s
Gitea Actions runner has filesystem mount issue preventing Node.js extraction. Solution: Build entire image with Docker (includes Node) instead of setup-node action. Simpler and more reliable - build happens inside container.
This commit is contained in:
+13
-62
@@ -3,75 +3,26 @@ name: CI/CD Pipeline
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job - verify Astro build works
|
build-and-deploy:
|
||||||
build:
|
name: Build & Deploy
|
||||||
name: Build Astro Site
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Build and Push Docker Image
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
# Login to registry
|
||||||
node-version: '20'
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login gitlab.impresion3d.pro -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
|
# Build image
|
||||||
|
docker build -t gitlab.impresion3d.pro/root/davidaragon-portfolio:latest .
|
||||||
|
|
||||||
|
# Push to registry
|
||||||
|
docker push gitlab.impresion3d.pro/root/davidaragon-portfolio:latest
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Deploy to Portainer
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Build site
|
|
||||||
run: npm run build
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
|
|
||||||
- name: Upload build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
# Deploy job - only on main branch push after build succeeds
|
|
||||||
deploy:
|
|
||||||
name: Deploy to Portainer
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build]
|
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Download build artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Login to Gitea registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: gitlab.impresion3d.pro
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
gitlab.impresion3d.pro/root/davidaragon-portfolio:latest
|
|
||||||
gitlab.impresion3d.pro/root/davidaragon-portfolio:${{ github.sha }}
|
|
||||||
cache-from: type=registry,ref=gitlab.impresion3d.pro/root/davidaragon-portfolio:buildcache
|
|
||||||
cache-to: type=registry,ref=gitlab.impresion3d.pro/root/davidaragon-portfolio:buildcache,mode=max
|
|
||||||
|
|
||||||
- name: Trigger Portainer webhook
|
|
||||||
run: |
|
run: |
|
||||||
curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}"
|
curl -X POST "${{ secrets.PORTAINER_WEBHOOK_URL }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user