feat: add fullstack TypeScript template with Docker support

- Created package.json for managing workspaces (frontend and backend)
- Added scripts for development, build, testing, and Docker operations
- Implemented kill-dev-processes.sh script to terminate development processes gracefully
This commit is contained in:
2025-05-29 08:03:49 +00:00
commit c40b069ab9
41 changed files with 36870 additions and 0 deletions

164
.woodpecker.yml Normal file
View File

@@ -0,0 +1,164 @@
# Woodpecker CI Pipeline für Full Stack TypeScript Template
# Automatisiert Docker Builds für main, beta und alpha branches
when:
event: [push, pull_request]
steps:
# =============================================================================
# Dependencies installieren und Tests ausführen
# =============================================================================
dependencies:
image: node:18-alpine
commands:
- echo "📦 Installing dependencies..."
- npm ci
- cd backend && npm ci && cd ..
- cd frontend && npm ci && cd ..
when:
event: [push, pull_request]
lint_and_test:
image: node:18-alpine
commands:
- echo "🔍 Running linting and tests..."
- cd backend && npm run test && cd ..
- cd frontend && npm run test -- --coverage --watchAll=false && cd ..
when:
event: [push, pull_request]
depends_on: [dependencies]
build_check:
image: node:18-alpine
commands:
- echo "🏗️ Testing production builds..."
- cd backend && npm run build && cd ..
- cd frontend && npm run build && cd ..
when:
event: [push, pull_request]
depends_on: [dependencies]
# =============================================================================
# Docker Build & Push für MAIN Branch (Production)
# =============================================================================
docker_build_push_main:
image: woodpeckerci/plugin-docker-buildx
settings:
repo: YOUR_REGISTRY/YOUR_ORG/fullstack-typescript-template
registry: YOUR_REGISTRY
platforms: linux/amd64,linux/arm64
tag: latest
dockerfile: Dockerfile
context: .
username:
from_secret: docker_username
password:
from_secret: docker_password
build_args:
- NODE_ENV=production
- BUILD_VERSION=${CI_COMMIT_SHA:0:8}
when:
branch: main
event: push
depends_on: [lint_and_test, build_check]
# =============================================================================
# Docker Build & Push für BETA Branch (Staging)
# =============================================================================
docker_build_push_beta:
image: woodpeckerci/plugin-docker-buildx
settings:
repo: YOUR_REGISTRY/YOUR_ORG/fullstack-typescript-template
registry: YOUR_REGISTRY
platforms: linux/amd64,linux/arm64
tag: beta
dockerfile: Dockerfile
context: .
username:
from_secret: docker_username
password:
from_secret: docker_password
build_args:
- NODE_ENV=staging
- BUILD_VERSION=${CI_COMMIT_SHA:0:8}
when:
branch: beta
event: push
depends_on: [lint_and_test, build_check]
# =============================================================================
# Docker Build & Push für ALPHA Branch (Development)
# =============================================================================
docker_build_push_alpha:
image: woodpeckerci/plugin-docker-buildx
settings:
repo: YOUR_REGISTRY/YOUR_ORG/fullstack-typescript-template
registry: YOUR_REGISTRY
platforms: linux/amd64,linux/arm64
tag: alpha
dockerfile: Dockerfile
context: .
username:
from_secret: docker_username
password:
from_secret: docker_password
build_args:
- NODE_ENV=development
- BUILD_VERSION=${CI_COMMIT_SHA:0:8}
when:
branch: alpha
event: push
depends_on: [lint_and_test, build_check]
# =============================================================================
# Notification bei erfolgreichem Build
# =============================================================================
notify_success:
image: alpine:latest
commands:
- echo "✅ Pipeline erfolgreich abgeschlossen!"
- echo "🐳 Docker Image gebaut für Branch: ${CI_COMMIT_BRANCH}"
- echo "📦 Tag: ${CI_COMMIT_BRANCH == 'main' ? 'latest' : CI_COMMIT_BRANCH}"
- echo "🔗 Commit: ${CI_COMMIT_SHA:0:8}"
when:
status: success
event: push
branch: [main, beta, alpha]
depends_on: [docker_build_push_main, docker_build_push_beta, docker_build_push_alpha]
# =============================================================================
# Security Scan (Optional - kann aktiviert werden)
# =============================================================================
# security_scan:
# image: aquasec/trivy:latest
# commands:
# - trivy image --exit-code 0 --severity HIGH,CRITICAL YOUR_REGISTRY/YOUR_ORG/fullstack-typescript-template:${CI_COMMIT_BRANCH == 'main' ? 'latest' : CI_COMMIT_BRANCH}
# when:
# branch: [main, beta, alpha]
# event: push
# depends_on: [docker_build_push_main, docker_build_push_beta, docker_build_push_alpha]
# =============================================================================
# Pipeline Services (falls externe Services für Tests benötigt werden)
# =============================================================================
# services:
# postgres:
# image: postgres:15-alpine
# environment:
# POSTGRES_DB: testdb
# POSTGRES_USER: test
# POSTGRES_PASSWORD: test
# ports:
# - 5432:5432
#
# redis:
# image: redis:7-alpine
# ports:
# - 6379:6379