docker build only populates the Docker daemon's store; k3s runs its own embedded containerd and never sees it, so imagePullPolicy: Never kept redeploying whatever was last imported instead of new builds. Co-Authored-By: Claude Sonnet 5 <[email protected]>
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest # hits the host runner (vps-runner) already on this box
|
|
env:
|
|
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build backend image
|
|
run: docker build -t realtime-collab-backend:latest ./backend
|
|
|
|
- name: Import image into k3s containerd
|
|
# docker build only populates the Docker daemon's store; k3s runs its
|
|
# own containerd (imagePullPolicy: Never, never pulls a registry), so
|
|
# the image must be explicitly imported or the pod keeps running
|
|
# whatever was last imported.
|
|
run: docker save realtime-collab-backend:latest | k3s ctr -n k8s.io images import -
|
|
|
|
- name: Roll out backend
|
|
run: |
|
|
kubectl rollout restart deployment/realtime-collab-backend
|
|
kubectl rollout status deployment/realtime-collab-backend --timeout=90s
|
|
|
|
- name: Build frontend
|
|
working-directory: frontend
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Deploy frontend
|
|
run: rsync -a --delete frontend/dist/ /var/www/realtime-collab/
|