feat(native): serve built frontend from backend; build frontend during install/update; ensure env flags (SERVE_FRONTEND, FRONTEND_DIR)
Mirror to GitHub / mirror (push) Successful in 43s
Test and Lint / backend-test (push) Successful in 1m31s
Test and Lint / frontend-test (push) Successful in 2m10s
Version and Release / version-bump (push) Successful in 58s
Version and Release / trigger-drone (push) Successful in 3s
Mirror to GitHub / mirror (push) Successful in 43s
Test and Lint / backend-test (push) Successful in 1m31s
Test and Lint / frontend-test (push) Successful in 2m10s
Version and Release / version-bump (push) Successful in 58s
Version and Release / trigger-drone (push) Successful in 3s
This commit is contained in:
+17
-1
@@ -1010,8 +1010,24 @@ update_native_installation() {
|
|||||||
# Run migrations
|
# Run migrations
|
||||||
run_as_user "npm run migrate"
|
run_as_user "npm run migrate"
|
||||||
|
|
||||||
|
# Rebuild frontend (ensure admin UI for native installs)
|
||||||
|
if [[ -d "$NATIVE_APP_DIR/app/frontend" ]]; then
|
||||||
|
log_step "Rebuilding frontend..."
|
||||||
|
cd "$NATIVE_APP_DIR/app/frontend"
|
||||||
|
run_as_user "npm ci --include=dev" || run_as_user "npm install"
|
||||||
|
run_as_user "npm run build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure env has frontend serving flags
|
||||||
|
if ! grep -q '^SERVE_FRONTEND=' "$NATIVE_APP_DIR/app/backend/.env"; then
|
||||||
|
echo "SERVE_FRONTEND=true" >> "$NATIVE_APP_DIR/app/backend/.env"
|
||||||
|
fi
|
||||||
|
if ! grep -q '^FRONTEND_DIR=' "$NATIVE_APP_DIR/app/backend/.env"; then
|
||||||
|
echo "FRONTEND_DIR=$NATIVE_APP_DIR/app/frontend/dist" >> "$NATIVE_APP_DIR/app/backend/.env"
|
||||||
|
fi
|
||||||
|
|
||||||
# Restart services
|
# Restart services
|
||||||
systemctl start picpeak-backend picpeak-workers
|
systemctl restart picpeak-backend picpeak-workers
|
||||||
|
|
||||||
log_success "Native installation updated successfully!"
|
log_success "Native installation updated successfully!"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user