mirror of
https://github.com/versia-pub/server.git
synced 2026-04-27 20:59:15 +02:00
feat: Improve build system to reduce Docker image to 312 MB
This commit is contained in:
parent
44aaa87f79
commit
ecf1139081
4 changed files with 60 additions and 13 deletions
37
entrypoint.sh
Executable file
37
entrypoint.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script is a wrapper for the main server, CLI and Prisma binaries.
|
||||
# Commands:
|
||||
# - `start`: Starts the server
|
||||
# - `cli`: Starts the CLI, sends all arguments to it
|
||||
# - `prisma`: Execute a Prisma command, sends
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# Parse first argument
|
||||
case "$1" in
|
||||
"start")
|
||||
# Start the server
|
||||
exec bun run ./dist/index.js
|
||||
;;
|
||||
"cli")
|
||||
# Start the CLI
|
||||
shift 1
|
||||
exec bun run ./dist/cli.js "$@"
|
||||
;;
|
||||
"prisma")
|
||||
# Proxy all Prisma commands
|
||||
# Use output of dist/prisma.js to get the env variable
|
||||
shift 1
|
||||
# Set DATABASE_URL env variable to the output of bun run ./dist/prisma.js
|
||||
export DATABASE_URL=$(bun run ./dist/prisma.js)
|
||||
# Execute the Prisma binary
|
||||
exec bunx prisma "$@"
|
||||
;;
|
||||
*)
|
||||
# Run custom commands
|
||||
exec "$@"
|
||||
;;
|
||||
esac
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue