25 lines
614 B
Bash
25 lines
614 B
Bash
#!/bin/bash
|
||
set -euo pipefail
|
||
|
||
APP_NAME="apskel-pos"
|
||
PORT="3300" # match the app’s listen port (and EXPOSE/healthcheck)
|
||
|
||
echo "🔄 Pulling latest code..."
|
||
git pull
|
||
|
||
echo "🐳 Building Docker image (production target)..."
|
||
docker build --target production -t $APP_NAME:latest .
|
||
|
||
echo "🛑 Stopping and removing old container..."
|
||
docker rm -f $APP_NAME 2>/dev/null || true
|
||
|
||
echo "🚀 Running new container..."
|
||
docker run -d --name $APP_NAME \
|
||
-p $PORT:$PORT \
|
||
-e TZ=Asia/Jakarta \
|
||
-v "$(pwd)/infra":/infra:ro \
|
||
-v "$(pwd)/templates":/templates:ro \
|
||
$APP_NAME:latest
|
||
|
||
echo "✅ Deployment complete."
|