diff --git a/.woodpecker/pipeline.yaml b/.woodpecker/pipeline.yaml index 49d3b5c..9736bb3 100644 --- a/.woodpecker/pipeline.yaml +++ b/.woodpecker/pipeline.yaml @@ -10,32 +10,43 @@ trigger: environment: NODE_ENV: production + HOME: /tmp # Fix for UID 0 "user does not exist" steps: - # Step 1: Install dependencies + # Step 1: Restore cached node_modules + - name: restore-cache + image: node:18-alpine + commands: + - echo "📦 Restoring cached node_modules..." + - mkdir -p /cache + - if [ -f /cache/node_modules.tar.gz ]; then tar -xzf /cache/node_modules.tar.gz; fi + + # Step 2: Install dependencies - name: install image: node:18-alpine commands: - echo "🔧 Installing dependencies..." - npm ci --silent + - echo "💾 Saving node_modules to cache..." + - tar -czf /cache/node_modules.tar.gz node_modules - # Step 2: Build Next.js + # Step 3: Build Next.js - name: build image: node:18-alpine commands: - - echo "🏗️ Building application..." + - echo "🏗️ Building Next.js app..." - npm run build - # Step 3: Build and push Docker image + # Step 4: Build and push Docker image - name: docker-build image: docker:24 - # Use host Docker daemon; no privileged mode needed volumes: - /var/run/docker.sock:/var/run/docker.sock environment: DOCKER_REGISTRY: git.badger-pirarucu.ts.net DOCKER_USER: ${DOCKER_USER} DOCKER_PASSWORD: ${DOCKER_PASSWORD} + HOME: /tmp commands: - echo "🔑 Logging into Gitea Docker registry..." - echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USER" --password-stdin