This commit is contained in:
Iliyan Angelov
2025-11-25 11:16:05 +02:00
parent 4c8b71fe0d
commit 8823edc8b3
3 changed files with 39 additions and 16 deletions

View File

@@ -221,6 +221,19 @@ if grep -q '"output":\s*"standalone"' next.config.js 2>/dev/null || grep -q "out
NODE_ENV=production PORT=$FRONTEND_PORT npm run build
fi
# Ensure public folder is copied to standalone directory
if [ ! -d ".next/standalone/public" ]; then
echo -e "${BLUE}Copying public folder to standalone directory...${NC}"
cp -r public .next/standalone/
fi
# Ensure static folder symlink exists for image optimization
if [ ! -L ".next/standalone/.next/static" ] && [ ! -d ".next/standalone/.next/static" ]; then
echo -e "${BLUE}Creating symlink for static files...${NC}"
mkdir -p .next/standalone/.next
ln -s ../../static .next/standalone/.next/static
fi
# Start standalone server with PM2
PORT=$FRONTEND_PORT NODE_ENV=production pm2 start node \
--name "gnxsoft-frontend" \