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
set -euo pipefail
APP_NAME="apskel-pos"
PORT="4000"
PORT="3300" # match the apps listen port (and EXPOSE/healthcheck)
echo "🔄 Pulling latest code..."
git pull
echo "🐳 Building Docker image..."
docker build -t $APP_NAME .
echo "🐳 Building Docker image (production target)..."
docker build --target production -t $APP_NAME:latest .
echo "🛑 Stopping and removing old container..."
docker stop $APP_NAME 2>/dev/null
docker rm $APP_NAME 2>/dev/null
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