fix: install and update script

This commit is contained in:
kilyabin
2025-11-24 02:56:59 +04:00
parent c5c6eb7875
commit 4aec72c4da
2 changed files with 22 additions and 16 deletions

View File

@@ -209,22 +209,24 @@ fi
echo -e "${YELLOW}Building the application...${NC}" echo -e "${YELLOW}Building the application...${NC}"
npm run build npm run build
# Ensure public directory is accessible in standalone build # Ensure public directory and static files are accessible in standalone build
echo -e "${YELLOW}Setting up static files...${NC}" echo -e "${YELLOW}Setting up static files...${NC}"
# In standalone mode, public should be in the root, which is already copied
# But we need to ensure .next/static is properly linked/copied
if [ -d "$INSTALL_DIR/.next/standalone" ]; then if [ -d "$INSTALL_DIR/.next/standalone" ]; then
# Copy public to standalone directory if it's not there # Copy public directory to standalone (always update)
if [ ! -d "$INSTALL_DIR/.next/standalone/public" ]; then if [ -d "$INSTALL_DIR/public" ]; then
echo -e "${YELLOW}Copying public directory to standalone...${NC}"
cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true
fi fi
# Ensure .next/static is accessible from standalone # Copy .next/static to standalone/.next/static (always update)
if [ ! -d "$INSTALL_DIR/.next/standalone/.next" ]; then if [ -d "$INSTALL_DIR/.next/static" ]; then
echo -e "${YELLOW}Copying .next/static to standalone...${NC}"
mkdir -p "$INSTALL_DIR/.next/standalone/.next" mkdir -p "$INSTALL_DIR/.next/standalone/.next"
fi
if [ ! -d "$INSTALL_DIR/.next/standalone/.next/static" ]; then
cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true
else
echo -e "${RED}Warning: .next/static directory not found!${NC}"
fi fi
else
echo -e "${RED}Warning: .next/standalone directory not found!${NC}"
fi fi
# Check if service user exists, create if not # Check if service user exists, create if not

View File

@@ -161,20 +161,24 @@ case "$1" in
echo -e "${YELLOW}Building application...${NC}" echo -e "${YELLOW}Building application...${NC}"
npm run build npm run build
# Ensure public directory is accessible in standalone build # Ensure public directory and static files are accessible in standalone build
echo -e "${YELLOW}Setting up static files...${NC}" echo -e "${YELLOW}Setting up static files...${NC}"
if [ -d "$INSTALL_DIR/.next/standalone" ]; then if [ -d "$INSTALL_DIR/.next/standalone" ]; then
# Copy public to standalone directory if it's not there # Copy public directory to standalone (always update)
if [ ! -d "$INSTALL_DIR/.next/standalone/public" ]; then if [ -d "$INSTALL_DIR/public" ]; then
echo -e "${YELLOW}Copying public directory to standalone...${NC}"
cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true cp -r "$INSTALL_DIR/public" "$INSTALL_DIR/.next/standalone/public" 2>/dev/null || true
fi fi
# Ensure .next/static is accessible from standalone # Copy .next/static to standalone/.next/static (always update)
if [ ! -d "$INSTALL_DIR/.next/standalone/.next" ]; then if [ -d "$INSTALL_DIR/.next/static" ]; then
echo -e "${YELLOW}Copying .next/static to standalone...${NC}"
mkdir -p "$INSTALL_DIR/.next/standalone/.next" mkdir -p "$INSTALL_DIR/.next/standalone/.next"
fi
if [ ! -d "$INSTALL_DIR/.next/standalone/.next/static" ]; then
cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true cp -r "$INSTALL_DIR/.next/static" "$INSTALL_DIR/.next/standalone/.next/static" 2>/dev/null || true
else
echo -e "${RED}Warning: .next/static directory not found!${NC}"
fi fi
else
echo -e "${RED}Warning: .next/standalone directory not found!${NC}"
fi fi
# Set ownership # Set ownership