# .woodpecker.yml dev1 ➜ aptiva‑staging kind: pipeline type: docker name: build-and-deploy workspace: base: /woodpecker path: src # repo will be /woodpecker/src clone: depth: 50 ############################################################ # 1. Build & push the four images to Artifact Registry ############################################################ steps: - name: build-and-push image: docker:24.0-cli # uses host’s Docker socket privileged: true # required for buildx volumes: - name: docker-sock # mount the host socket path: /var/run/docker.sock commands: | set -euo pipefail 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 . done when: event: [push, manual] branch: [master] ############################################################ # 2. Rolling update on the *staging* VM ############################################################ - name: deploy-staging image: appleboy/drone-ssh settings: host: 10.128.0.12 # internal IP of aptiva‑staging port: 22 username: jcoakley key: from_secret: STAGING_SSH_KEY known_hosts: from_secret: STAGING_KNOWN_HOSTS script: - cd /opt/aptiva-staging-app - ./refresh_secrets.sh # pulls latest Secret‑Manager values - TAG=$(echo "$CI_COMMIT_SHA" | head -c 8) - IMG_TAG=$TAG docker compose pull - IMG_TAG=$TAG docker compose up -d --remove-orphans when: event: [push, manual] branch: [master] ############################################################ # 3. Volumes (declared once, referenced by name) ############################################################ volumes: - name: docker-sock host: path: /var/run/docker.sock