rewrite v5 of woodpecker.yml
This commit is contained in:
parent
632cb6eba5
commit
c40882ee59
@ -1,49 +1,41 @@
|
||||
# .woodpecker.yml dev1 ➜ aptiva‑staging
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-and-deploy
|
||||
|
||||
workspace:
|
||||
base: /woodpecker
|
||||
path: src # repo will be /woodpecker/src
|
||||
path: src
|
||||
|
||||
clone:
|
||||
depth: 50
|
||||
|
||||
############################################################
|
||||
# 1. Build & push the four images to Artifact Registry
|
||||
############################################################
|
||||
steps:
|
||||
# ─── build & push ──────────────────────────────────────────
|
||||
- name: build-and-push
|
||||
image: docker:24.0-cli # uses host’s Docker socket
|
||||
privileged: true # required for buildx
|
||||
image: docker:24.0-cli # only the CLI, we re‑use host docker
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: docker-sock # mount the host socket
|
||||
- name: docker-sock # mount declared at bottom
|
||||
path: /var/run/docker.sock
|
||||
commands: |
|
||||
set -euo pipefail
|
||||
commands:
|
||||
- |
|
||||
set -e
|
||||
REG=us-central1-docker.pkg.dev/aptivaai-dev/aptiva-repo
|
||||
TAG=$(echo "$CI_COMMIT_SHA" | head -c 8)
|
||||
|
||||
docker buildx create --use --name woodpecker || true
|
||||
|
||||
for svc in server1 server2 server3 nginx ; do
|
||||
docker buildx build \
|
||||
--file Dockerfile.${svc} \
|
||||
--tag ${REG}/${svc}:${TAG} \
|
||||
--push .
|
||||
docker buildx build -f Dockerfile.${svc} \
|
||||
-t ${REG}/${svc}:${TAG} --push .
|
||||
done
|
||||
when:
|
||||
event: [push, manual]
|
||||
branch: [master]
|
||||
|
||||
############################################################
|
||||
# 2. Rolling update on the *staging* VM
|
||||
############################################################
|
||||
# ─── deploy staging ────────────────────────────────────────
|
||||
- name: deploy-staging
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host: 10.128.0.12 # internal IP of aptiva‑staging
|
||||
host: 10.128.0.12
|
||||
port: 22
|
||||
username: jcoakley
|
||||
key:
|
||||
@ -52,7 +44,7 @@ steps:
|
||||
from_secret: STAGING_KNOWN_HOSTS
|
||||
script:
|
||||
- cd /opt/aptiva-staging-app
|
||||
- ./refresh_secrets.sh # pulls latest Secret‑Manager values
|
||||
- ./refresh_secrets.sh
|
||||
- TAG=$(echo "$CI_COMMIT_SHA" | head -c 8)
|
||||
- IMG_TAG=$TAG docker compose pull
|
||||
- IMG_TAG=$TAG docker compose up -d --remove-orphans
|
||||
@ -60,9 +52,7 @@ steps:
|
||||
event: [push, manual]
|
||||
branch: [master]
|
||||
|
||||
############################################################
|
||||
# 3. Volumes (declared once, referenced by name)
|
||||
############################################################
|
||||
# ─── global volume declaration (list **not** indented) ─────
|
||||
volumes:
|
||||
- name: docker-sock
|
||||
host:
|
||||
|
Loading…
Reference in New Issue
Block a user