aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-image.sh8
-rwxr-xr-xscripts/image-startup.sh5
-rwxr-xr-xscripts/start-local-db.sh11
3 files changed, 24 insertions, 0 deletions
diff --git a/scripts/build-image.sh b/scripts/build-image.sh
new file mode 100755
index 0000000..55ef4a4
--- /dev/null
+++ b/scripts/build-image.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+SPLIIT_APP_NAME=$(node -p -e "require('./package.json').name")
+SPLIIT_VERSION=$(node -p -e "require('./package.json').version")
+
+docker buildx build --no-cache -t ${SPLIIT_APP_NAME}:${SPLIIT_VERSION} -t ${SPLIIT_APP_NAME}:latest .
+
+docker image prune -f
diff --git a/scripts/image-startup.sh b/scripts/image-startup.sh
new file mode 100755
index 0000000..8a3a90a
--- /dev/null
+++ b/scripts/image-startup.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+prisma migrate deploy
+prisma generate
+npm run dev
diff --git a/scripts/start-local-db.sh b/scripts/start-local-db.sh
new file mode 100755
index 0000000..c97173d
--- /dev/null
+++ b/scripts/start-local-db.sh
@@ -0,0 +1,11 @@
+result=$(docker ps | grep postgres)
+if [ $? -eq 0 ];
+then
+ echo "postgres is already running, doing nothing"
+else
+ echo "postgres is not running, starting it"
+ docker rm postgres --force
+ mkdir -p postgres-data
+ docker run --name postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=1234 -v ./postgres-data:/var/lib/postgresql/data postgres
+ sleep 5 # Wait for postgres to start
+fi