deployment

This commit is contained in:
Aditya Siregar 2025-09-01 16:18:34 +07:00
parent f91f85202e
commit 4c6dc5c8b4

View File

@ -1,21 +1,22 @@
#!/bin/bash #!/bin/bash
set -euo pipefail
APP_NAME="apskel-pos" APP_NAME="apskel-pos"
PORT="4000" PORT="3300" # match the apps listen port (and EXPOSE/healthcheck)
echo "🔄 Pulling latest code..." echo "🔄 Pulling latest code..."
git pull git pull
echo "🐳 Building Docker image..." echo "🐳 Building Docker image (production target)..."
docker build -t $APP_NAME . docker build --target production -t $APP_NAME:latest .
echo "🛑 Stopping and removing old container..." echo "🛑 Stopping and removing old container..."
docker stop $APP_NAME 2>/dev/null docker rm -f $APP_NAME 2>/dev/null || true
docker rm $APP_NAME 2>/dev/null
echo "🚀 Running new container..." echo "🚀 Running new container..."
docker run -d --name $APP_NAME \ docker run -d --name $APP_NAME \
-p $PORT:$PORT \ -p $PORT:$PORT \
-e TZ=Asia/Jakarta \
-v "$(pwd)/infra":/infra:ro \ -v "$(pwd)/infra":/infra:ro \
-v "$(pwd)/templates":/templates:ro \ -v "$(pwd)/templates":/templates:ro \
$APP_NAME:latest $APP_NAME:latest