Some checks failed
continuous-integration/drone/push Build is failing
85 lines
2.1 KiB
YAML
85 lines
2.1 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: build-and-deploy-docs
|
|
|
|
platform:
|
|
os: linux
|
|
arch: arm64
|
|
|
|
workspace:
|
|
path: /drone/src
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
host:
|
|
path: /var/run/docker.sock
|
|
|
|
steps:
|
|
# # 🏗️ Step 1: Build static docs for all projects
|
|
# - name: build-docs
|
|
# image: squidfunk/mkdocs-material
|
|
# commands:
|
|
# - echo "🧱 Building documentation for all projects..."
|
|
# - cd mongo-ops && mkdocs build --clean && cd ..
|
|
# - echo "✅ All docs built successfully."
|
|
|
|
# 🐳 Step 2: Build Docker image for docs site
|
|
- name: build-image
|
|
image: docker:24
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- echo "🔨 Building Docker image for docs..."
|
|
- docker build -t apps/docs:latest .
|
|
|
|
# 📤 Step 3: Push image to private registry
|
|
- name: push-image
|
|
image: docker:24
|
|
environment:
|
|
REGISTRY_HOST:
|
|
from_secret: REGISTRY_HOST
|
|
REGISTRY_USER:
|
|
from_secret: REGISTRY_USER
|
|
REGISTRY_PASS:
|
|
from_secret: REGISTRY_PASS
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- echo "🔑 Logging into registry $REGISTRY_HOST ..."
|
|
- echo "$REGISTRY_PASS" | docker login $REGISTRY_HOST -u "$REGISTRY_USER" --password-stdin
|
|
- docker tag apps/docs:latest $REGISTRY_HOST/apps/docs:latest
|
|
- echo "📦 Pushing image to $REGISTRY_HOST..."
|
|
- docker push $REGISTRY_HOST/apps/docs:latest
|
|
|
|
- name: stop-old
|
|
image: docker:24
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- echo "🛑 Stopping old container..."
|
|
- docker rm -f homepage || true
|
|
|
|
- name: run-container
|
|
image: docker:24
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- echo "🚀 Starting container apps/docs:latest ..."
|
|
- |
|
|
docker run -d \
|
|
--name docs \
|
|
-p 6007:80 \
|
|
-e NODE_ENV=production \
|
|
--restart always \
|
|
apps/docs:latest
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- tag
|