pipeline: # Build and test backend build-and-test: image: mcr.microsoft.com/dotnet/sdk:9.0 commands: - dotnet restore GermanApp/GermanApp.csproj - dotnet build GermanApp/GermanApp.csproj --no-restore --configuration Release - dotnet test Tests/GermanApp.Tests.Unit.csproj --no-build --configuration Release - dotnet test Tests/GermanApp.Tests.Integration.csproj --no-build --configuration Release when: branch: - main - feature/* - bugfix/* - refactor/* # Build and push backend image build-backend: image: plugins/docker settings: dockerfile: GermanApp/Dockerfile context: GermanApp registry: registry.lrhdev.dk repo: registry.lrhdev.dk/lasserh/deutschlernen-backend tags: - latest - ${CI_COMMIT_SHA:0:8} username: from_secret: docker_username password: from_secret: docker_password when: branch: - main status: - success # Build and push frontend image build-frontend: image: plugins/docker settings: dockerfile: german-app-frontend/Dockerfile context: german-app-frontend registry: registry.lrhdev.dk repo: registry.lrhdev.dk/lasserh/deutschlernen-frontend tags: - latest - ${CI_COMMIT_SHA:0:8} username: from_secret: docker_username password: from_secret: docker_password when: branch: - main status: - success # Deploy to production deploy: image: alpine commands: - apk add --no-cache openssh-client - mkdir -p ~/.ssh - echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan deutsch.lrhdev.dk >> ~/.ssh/known_hosts # Pull new images and restart containers - ssh ci-deploy@deutsch.lrhdev.dk "cd /opt/deutschlernen && docker-compose pull && docker-compose up -d" # Reload nginx to pick up any new configurations - ssh ci-deploy@deutsch.lrhdev.dk "nginx -t && nginx -s reload" secrets: - SSH_PRIVATE_KEY when: branch: - main status: - success # ============================================ # WOODPECKER CONFIGURATION NOTES # ============================================ # # Required Secrets (configure in Woodpecker UI): # -------------------------------------------- # 1. docker_username - Your registry username for registry.lrhdev.dk # 2. docker_password - Your registry password for registry.lrhdev.dk # 3. SSH_PRIVATE_KEY - SSH private key for deploying to deutsch.lrhdev.dk # # Registry Configuration: # ----------------------- # - Registry URL: registry.lrhdev.dk # - Repository: registry.lrhdev.dk/lasserh/deutschlernen # - Images will be tagged as: latest and # # Deployment: # ---------- # The deploy stage connects via SSH to deutsch.lrhdev.dk and: # 1. Pulls the latest backend image # 2. Restarts the backend container # # Customize the deploy command to match your docker-compose setup. # If you use a different path or service name, update the ssh command. # # ============================================