woodpecker test 4
This commit is contained in:
parent
ab8640a831
commit
c14ef1bc56
@ -1,50 +1,47 @@
|
|||||||
# .woodpecker.yml
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
- feat/*
|
||||||
|
- feature/*
|
||||||
|
|
||||||
# Run pipeline on pushes to main and pull requests
|
|
||||||
when:
|
|
||||||
event: [push, pull_request]
|
|
||||||
branch: [main, develop, feat/*, feature/*]
|
|
||||||
|
|
||||||
# Define environment variables
|
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
|
|
||||||
# Pipeline steps
|
|
||||||
steps:
|
steps:
|
||||||
# Install dependencies
|
# Step 1: Install dependencies
|
||||||
- name: install
|
- name: install
|
||||||
image: node:18-alpine
|
image: node:18-alpine
|
||||||
commands:
|
commands:
|
||||||
- echo "🔧 Installing dependencies.."
|
- echo "🔧 Installing dependencies..."
|
||||||
- npm ci --silent
|
- npm ci --silent
|
||||||
when:
|
|
||||||
event: [push, pull_request]
|
|
||||||
|
|
||||||
# Build application
|
# Step 2: Build Next.js
|
||||||
- name: build
|
- name: build
|
||||||
image: node:18-alpine
|
image: node:18-alpine
|
||||||
commands:
|
commands:
|
||||||
- echo "🏗️ Building application..."
|
- echo "🏗️ Building application..."
|
||||||
- npm run build
|
- npm run build
|
||||||
when:
|
|
||||||
event: [push, pull_request]
|
|
||||||
|
|
||||||
|
# Step 3: Build and push Docker image
|
||||||
- name: docker-build
|
- name: docker-build
|
||||||
image: docker:24
|
image: docker:24
|
||||||
|
# Use host Docker daemon; no privileged mode needed
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
environment:
|
environment:
|
||||||
DOCKER_REGISTRY: git.badger-pirarucu.ts.net
|
DOCKER_REGISTRY: git.badger-pirarucu.ts.net
|
||||||
DOCKER_USER: ${DOCKER_USER}
|
DOCKER_USER: ${DOCKER_USER}
|
||||||
DOCKER_PASSWORD: ${DOCKER_PASSWORD}
|
DOCKER_PASSWORD: ${DOCKER_PASSWORD}
|
||||||
IMAGE_NAME: ${DOCKER_REGISTRY}/username/nextjs-app
|
|
||||||
commands:
|
commands:
|
||||||
- echo "Logging into Gitea Docker registry..."
|
- echo "🔑 Logging into Gitea Docker registry..."
|
||||||
- echo $DOCKER_PASSWORD | docker login $DOCKER_REGISTRY -u $DOCKER_USER --password-stdin
|
- echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USER" --password-stdin
|
||||||
- echo "Building Docker image..."
|
- IMAGE_NAME="$DOCKER_REGISTRY/username/nextjs-app"
|
||||||
- docker build -t $IMAGE_NAME:latest .
|
- echo "🐳 Building Docker image..."
|
||||||
- echo "Pushing Docker image..."
|
- docker build -t "$IMAGE_NAME:latest" .
|
||||||
- docker push $IMAGE_NAME:latest
|
- echo "🚀 Pushing Docker image..."
|
||||||
when:
|
- docker push "$IMAGE_NAME:latest"
|
||||||
event: [push]
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user