Archived
deploy: Dockerfile, entrypoint, standalone output, dockerignore
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
# MapleBrief entrypoint
|
||||
# 1) First boot: seed /data with the clean migrated DB + write privileged key if provided
|
||||
# 2) Start Next standalone server
|
||||
set -e
|
||||
cd /app
|
||||
|
||||
DB="${DATABASE_URL#file:}"
|
||||
[ -n "$DB" ] || DB=/data/dev.db
|
||||
|
||||
# Export an absolute DATABASE_URL for the Node/Prisma process (relative
|
||||
# paths resolve against the schema dir and can point at the wrong file).
|
||||
case "$DB" in
|
||||
/*) ;;
|
||||
*) DB="/$DB" ;;
|
||||
esac
|
||||
export DATABASE_URL="file:$DB"
|
||||
|
||||
if [ ! -f "$DB" ]; then
|
||||
# create parent dir (volume may be fresh)
|
||||
DIR="$(dirname "$DB")"
|
||||
mkdir -p "$DIR"
|
||||
cp ./seed-dev.db "$DB"
|
||||
echo "[entrypoint] initialized $DB from seed snapshot"
|
||||
fi
|
||||
|
||||
exec node server.js
|
||||
Reference in New Issue
Block a user