From 0117a4889a9d92c6c95948c9ea3eed3fc4456059 Mon Sep 17 00:00:00 2001 From: Efril Date: Sun, 26 Apr 2026 20:57:15 +0700 Subject: [PATCH] update deployment --- deployment.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/deployment.sh b/deployment.sh index 4122a2d..677eb8f 100644 --- a/deployment.sh +++ b/deployment.sh @@ -1,23 +1,25 @@ -#!/bin/bash - APP_NAME="eslogad" PORT="4000" +NETWORK_NAME="pgnet" echo "🔄 Pulling latest code..." git pull echo "🐳 Building Docker image..." -docker build -t $APP_NAME . +docker build -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 stop "$APP_NAME" 2>/dev/null || true +docker rm "$APP_NAME" 2>/dev/null || true + +echo "🔌 Ensuring Docker network exists..." +docker network inspect "$NETWORK_NAME" >/dev/null 2>&1 || docker network create "$NETWORK_NAME" echo "🚀 Running new container..." -docker run -d --name $APP_NAME \ - -p $PORT:$PORT \ +docker run -d \ + --name "$APP_NAME" \ + --network "$NETWORK_NAME" \ + -p "$PORT:$PORT" \ -v "$(pwd)/infra":/infra:ro \ -v "$(pwd)/templates":/templates:ro \ - $APP_NAME:latest - -echo "✅ Deployment complete." + "$APP_NAME:latest" \ No newline at end of file