apskel-pos-backend/deployment.sh

25 lines
614 B
Bash
Raw Normal View History

2025-08-08 22:48:57 +07:00
#!/bin/bash
2025-09-01 16:18:34 +07:00
set -euo pipefail
2025-08-08 22:48:57 +07:00
APP_NAME="apskel-pos"
2025-09-01 16:18:34 +07:00
PORT="3300" # match the apps listen port (and EXPOSE/healthcheck)
2025-08-08 22:48:57 +07:00
echo "🔄 Pulling latest code..."
git pull
2025-09-01 16:18:34 +07:00
echo "🐳 Building Docker image (production target)..."
docker build --target production -t $APP_NAME:latest .
2025-08-08 22:48:57 +07:00
echo "🛑 Stopping and removing old container..."
2025-09-01 16:18:34 +07:00
docker rm -f $APP_NAME 2>/dev/null || true
2025-08-08 22:48:57 +07:00
echo "🚀 Running new container..."
docker run -d --name $APP_NAME \
-p $PORT:$PORT \
2025-09-01 16:18:34 +07:00
-e TZ=Asia/Jakarta \
2025-08-08 22:48:57 +07:00
-v "$(pwd)/infra":/infra:ro \
-v "$(pwd)/templates":/templates:ro \
$APP_NAME:latest
echo "✅ Deployment complete."