You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Harden deployment: health checks, non-root user, compose-based CD, image cleanup
- Add HEALTHCHECK + /health endpoint, run as non-root USER node
- Replace bare docker run with docker compose on VPS (up -d --wait)
- Add tag push trigger (v*) alongside manual workflow_dispatch
- Clean up old images: docker image prune on VPS, GHCR keep last 10
- Document node_modules volume override for dependency-heavy apps
- Update README (en/ko) and VPS_DEPLOY.md to reflect all changes
For multi-container setups, replace the SSH deploy step in `cd.yml`:
111
+
The default deployment creates a single-service `docker-compose.yml` on VPS at `~/app/`.
112
+
To add services (database, Redis, etc.), manually edit `~/app/docker-compose.yml` on your VPS:
98
113
99
114
```yaml
100
-
- name: Deploy to VPS via SSH
101
-
uses: appleboy/ssh-action@v1
102
-
with:
103
-
host: ${{ secrets.VPS_HOST }}
104
-
username: ${{ secrets.VPS_USER }}
105
-
key: ${{ secrets.VPS_SSH_KEY }}
106
-
script: |
107
-
cd ~/app
108
-
docker compose pull
109
-
docker compose up -d
115
+
services:
116
+
app:
117
+
image: ghcr.io/your-user/your-repo:latest
118
+
env_file: ~/.env.app
119
+
ports:
120
+
- "3000:3000"
121
+
restart: unless-stopped
122
+
depends_on:
123
+
db:
124
+
condition: service_healthy
125
+
126
+
db:
127
+
image: postgres:16-alpine
128
+
environment:
129
+
POSTGRES_PASSWORD: ${DB_PASSWORD}
130
+
volumes:
131
+
- pgdata:/var/lib/postgresql/data
132
+
restart: unless-stopped
133
+
134
+
volumes:
135
+
pgdata:
110
136
```
111
137
112
-
And place a `docker-compose.prod.yml` on your VPS at `~/app/docker-compose.yml`.
138
+
> **Note:** The CD workflow overwrites `~/app/docker-compose.yml` on each deploy. For multi-container setups, update the SSH deploy script in `cd.yml` to preserve your additional services, or manage the compose file separately on the VPS.
0 commit comments