Slim down server compose: entrypoint roles, self-migrating image
- docker-entrypoint.sh: `web` (default) or `worker`; both apply pending migrations under a flock on /data, so no start-order dependency - docker-healthcheck.sh baked into the image for both roles - deploy/compose.yaml reduced to image, role, env file, volumes, port - dist/migrate.mjs bundled alongside the worker Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
30b01d7bca
commit
fbcdcf2e2d
8 files changed
+65
-72
No files matched your search
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# Usage: docker run <image> [web|worker|<any command>] (default: web)
|
||||
set -e
|
||||
|
||||
role="${1:-web}"
|
||||
|
||||
case "$role" in
|
||||
web|worker)
|
||||
echo "$role" > /tmp/kaname-role
|
||||
# web and worker usually start together; the lock makes sure only one runs the migrations.
|
||||
mkdir -p /data
|
||||
flock /data/.migrate.lock node dist/migrate.mjs
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$role" in
|
||||
web) exec node_modules/.bin/next start ;;
|
||||
worker) exec node dist/worker.mjs ;;
|
||||
*) exec "$@" ;;
|
||||
esac
|
||||
Reference in new issue
Block a user