Added and updated config for CD with portainer and GitOps
This commit is contained in:
1 parent
3743d17705
commit
35a6863745
4 files changed
+57
-31
No files matched your search
+20
-30
@@ -1,33 +1,23 @@
|
||||
image: oven/bun:alpine
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
||||
cache:
|
||||
key:
|
||||
files:
|
||||
- bun.lock
|
||||
paths:
|
||||
- .next/cache/
|
||||
- node_modules/
|
||||
- build
|
||||
- deploy
|
||||
|
||||
# Your existing Bun build job goes here...
|
||||
build_job:
|
||||
stage: build
|
||||
# Target the specific runner we just created
|
||||
tags:
|
||||
- nextjs
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
script:
|
||||
- echo "Installing dependencies..."
|
||||
- bun ci # 'npm ci' is faster and safer for CI/CD than 'npm install'
|
||||
- echo "Building the Next.js application..."
|
||||
- bun run build
|
||||
# Save the build output so it can be used in later deployment stages
|
||||
artifacts:
|
||||
paths:
|
||||
- .next/
|
||||
- public/
|
||||
- package.json
|
||||
expire_in: 1 week
|
||||
stage: build
|
||||
# ... (keep your existing build job settings here)
|
||||
|
||||
# The new simplified deployment job
|
||||
deploy_production:
|
||||
stage: deploy
|
||||
image: curlimages/curl:latest # A tiny image just to send the webhook
|
||||
tags:
|
||||
- nextjs
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "main"
|
||||
# This job only runs if the build_job passes successfully
|
||||
needs: ["build_job"]
|
||||
script:
|
||||
- echo "Triggering Portainer GitOps Webhook..."
|
||||
# Replace the URL below with your actual Portainer webhook URL
|
||||
- curl -X POST "https://portainer.vpn.pascalyazid.com/api/stacks/webhooks/e73812d9-cf5e-4ac4-8648-53f7611b41c8"
|
||||
Reference in new issue
Block a user